I got a question regarding, PHP include path, it behaves differently in two environment.
Folder Structure:
Windows
|-C:\wamp\www\cms\themes\child
|-C:\wamp\www\cms\themes\parent
Linux
|-/var/www/html/cms/themes/child
|-/var/www/html/cms/themes/parent
Linux Environtment
var_dump(realpath('/')); // means /
var_dump(realpath('/../parent/scripts/import.php')); //boolean false
include('/../parent/scripts/import.php'); //it will not work
include('../parent/scripts/import.php'); //it will not work, except it will reference parent folder
Windows Environment
var_dump(realpath('/')); //C:\
var_dump(realpath('/../parent/scripts/import.php')); //boolean false
include('../parent/scripts/import.php'); //am thinking it will work at first, but it does not work in windows (feel weird)
include('/../parent/scripts/import.php'); //it work in windows (feel weird)
I know the best practise is, it work in both platform
include(realpath(dirname(__FILE__)).'/../parent/scripts/import.php');
But I would like to know about this, is it a PHP bug or what cause this?