Tip: Difference between $_SERVER['SCRIPT_FILENAME'] and __FILE__

The $_SERVER['SCRIPT_FILENAME'] variable will return same path whether it is used in the main file or in an included file on the other hand __FILE__ variable will return you the path of included file if used inside an included file and the path of main file if used inside the main file. I am referring to main file the one whose name is displayed in the address bar of browser.

 

More PHP tips