Nick Halstead has posted the latest programming tip to his blog today (as written by LArry Garfield) concerning the use of debug_backtrace.
Despite the proliferation of debugging tools, especially real-time debuggers, "debugging by print statement" remains the most common form of debugging in most programming languages. [...] Fortunately, PHP offers another debugging tool: debug_backtrace(). It returns an array that is a complete function stack up to the point it is called.
Larry includes a basic example of the function in use - a debug() function that takes in a message, label and a "stealth" setting and outputs a formatted result of the debug_backtrace output.