Difference Between getcwd() and dirname(__FILE__) ? Which should I use?
__FILE__ is a magic constant containing the full path to the file you are executing. If you are inside an include, its path will be the contents of __FILE__. So with this setup: /folder/random/foo.php <?php echo getcwd() . “\n”; echo dirname(__FILE__) . “\n” ; echo “——-\n”; include ‘bar/bar.php’; /folder/random/bar/bar.php <?php echo getcwd() . “\n”; echo … Read more