Knowing which PHP function call the code we are working on can give us the clues we need for de-bugging a script.
Getting the calling function is easy in PHP, thanks to the debug_backtrace() function.
Just put the following code wherever in your script you need to know what function is calling the part you are working on.
$backtrace = debug_backtrace(); print "The function that just called this code is " .$backtrace['function'] . ".";
This will output something like this:
The function that just called this code is DrawWidget.
Where DrawWidget is the name of the function.
I hope this comes in handy for someone. Thanks for visiting!