[thelist] PHP -- get name of calling function?

Svend Tofte svend at svendtofte.com
Tue Jul 29 17:14:55 CDT 2008


2008/7/30 Stephen Rider <evolt_org at striderweb.com>:

> Is there any way in PHP to get the name of the function that called
> the one you're in right now?

In general, this is properly referred to as a "stack trace". Other
terms could be retrieving the call stack, etc.

Anyway, some quick googling returns these functions:

http://dk.php.net/manual/en/function.debug-print-backtrace.php
->
http://dk.php.net/manual/en/function.debug-print-backtrace.php#74167

And more generally:
http://dk2.php.net/debug_backtrace

Regards,
Svend



More information about the thelist mailing list