Re: HELP: Detecting the name of the file a function is being called from

From: Date: Tue, 10 Feb 2004 04:36:51 +0000
Subject: Re: HELP: Detecting the name of the file a function is being called from
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177249@lists.php.net to get a copy of this message
On Mon, 2004-02-09 at 23:17, Samuel Ventura wrote: > what I need is to detect the name of the script > from which I called the function, (test2.php) in this > case. > > For this application, it is not practical to pass an > aditional parameter to the function specifying the > caller, i need independence. > > Any ideas? I don't think this is possible in php4. The __FILE__ variable is a constant that is always replaced with a string containing the name of the file it is in. Check out reflection[1] in php5 for an answer from the future. [1] http://sitten-polizei.de/php/reflection_api/docs/language.reflection.html -- Adam Bregenzer adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#177249) next »