Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include files './file.php' as opposed to 'file.php'

Status
Not open for further replies.

overflo

Technical User
Feb 10, 2003
70
AU
Just wondering what, if any, is the difference when including a file from the same directory between './file.php' and
'file.php'.


Is there any reason to use the
./

or are there instances where one should be used in preference to the other.

Thanks in advance

 
Same as the usual *nix security rules for using ./

include("somefile.php");

will look through the current directory, and then any entries in your include paths as defined in php.ini

So, in theory, not using the ./ could cause confusion when you forget to put the intended file in your current directory, but it does appear in your include path.
 
Or worse, a different file with the same name appears in your include path...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top