I have a function that is often called inside of other functions, and I'd like to be able to find out automatically what the name of the referring function (if any) was.
Something like this:
function do_something()
{
do_something_else();
}
function do_something_else()
{
echo referring_function(); // prints 'do_something'
}
Is there any easy way to do this? Note that I know it can be done manually by passing the name as a parameter, but I'd like to know if there's a simpler approach to this. Also, I'm not looking for the __FUNCTION__
constant, as that returns the name of the function in which it is called. I want the name of the function that called the current function.