This is just a little snippet that I wrote whilst trying to debug some dodgy MYSQL calls that were causing problems. It allows you to backtrace all functions and files that have led to the problem, mapping it through a breadcrumb of sorts. REALLY helpful when tracing other people’s code also…

function get_callee() {
    // relies on debug_backtrace();
    $retstring = '';
    $backtrace = debug_backtrace();
    for($ii = 1; $ii < count($backtrace); ++$ii)
        $retstring[] = basename($backtrace[$ii]['file']) . ' - ' . $backtrace[$ii]['function'] . ' (' . $backtrace[$ii]['line'] . ')';
    return implode(" > ", $retstring);
} // end get_callee();

// use simply like so:
echo get_callee();

I hope it helps somebody