You might come across the
__FILE__ constant in almost every PHP Application. In most cases it'll work just fine. But when you're using this constant in a symbolic linked file, there's surprise!
Assume we have this simple file structure
dir/dir/a.php --> dir/a.php (symlink of a.php)
Now, in your
dir/a.php file you have this code
/* Since we symlinked it to dir/dir/ so it should be able to include b.php */
But the result that you'll get is
file does not exist? Why is that?
It turns out that
__FILE__ constant always return absolute path with symlink resolved. So the returned path from above code is
dir/dir/. See http://php.net/manual/en/language.constants.predefined.php