Check the constants section of the manual... __FILE__ (case-insensitive)
The name of the script file presently being parsed. If used within a file which has been included or required, then the name of the included file is given, and not the name of the parent file. On Wed, 3 Apr 2002, Mikhail Avrekh wrote: > Hello, > > Is there any way inside an included file to figure out what its actual > UNIX filename is ? > > For example: > > file1.php -- > <? > > include("file2.php"); > > ?> > > file2.php -- > <? > /*want to do something like: > if (this_file()=="file2.php") { > ## do stuff > } else if (this_file()=="file1.php") { > ## do other stuff > } > */ > ?> > > That is, file2.php needs to know whether it's executed in the context of > file1.php or autonomously. I guess I could change $PHP_SELF before > including file2.php in file1.php, but that seems like a bad hack, plus it > may screw up other code in file1.php, if there is any. > > Any suggestions ? > M. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php