RE: [PHP] getting a function name of the calling function

From: Date: Thu, 02 May 2002 03:53:50 +0000
Subject: RE: [PHP] getting a function name of the calling function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-95631@lists.php.net to get a copy of this message
> I actually need it to print out the name of itself for error detection > purposes. > > > > Does anybody know of any constants or predefined functions that will > > > retrieve the calling functions name? For example: > > > > > > <? > > > function new_func($somedata) { > > > echo "I am function ".get_func_name(); > > > } > > > ?> > > This example should print out: > I am function new_func > > Is this possible? No, not with any PHP function I see in the manual. Can you explain why you need to do this? You can call a function name with a variable. Like for your example $variable = "new_func"; $variable("data"); That'll work. Explain what your trying to do and we can probably help you find a better approach. ---John Holmes...

« previous php.general (#95631) next »