It seems that the following two styles of code do the same job:
require_once './foo.php';
require_once './../bar.php';
require_once __DIR__.'/foo.php';
require_once __DIR__.'/../bar.php';
Clearly, the first form is shorter and cleaner. However, I see the second form in many third-party codes. Is there a reason to prefer the second form?
Phpst source
share