[thelist] Q on PHP functions...

Richard Davey rich at launchcode.co.uk
Tue Apr 6 13:18:41 CDT 2004


Hello jsWalter,

Tuesday, April 6, 2004, 6:58:54 PM, you wrote:

j> is it possible to display the name of the function within the current
j> function?

j> function foo()
j> {
j>    echo <thisFuncName>;  // this should display 'foo'
j> }

No, but then it's impossible for the echo statement to ever execute
without the function being called, so you always know the name of it
somehow.

You can use get_defined_functions() and search the ["user"] section of
the array that comes back for a list of all public declared functions.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html




More information about the thelist mailing list