included file name

From: Date: Thu, 04 Apr 2002 00:22:00 +0000
Subject: included file name
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-91439@lists.php.net to get a copy of this message
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.

« previous php.general (#91439) next »