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

Stephen Rider evolt_org at striderweb.com
Tue Jul 29 20:07:01 CDT 2008


On Jul 29, 2008, at 5:14 PM, Svend Tofte wrote:

> 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

Thanks much.  I'd seen debug_backtrace on the PHP manual site, but it  
wasn't clear that it returned an array with the whole history....

Exactly what I needed though.  :)

Stephen



More information about the thelist mailing list