| // | Aidan Lister | // +----------------------------------------------------------------------+ // // $Id$ /** * Replace debug_print_backtrace() * * @category PHP * @package PHP_Compat * @link http://php.net/function.debug_print_backtrace * @author Laurent Laville * @author Aidan Lister * @version $Revision: 1.3 $ * @since PHP 5 * @require PHP 4.3.0 (debug_backtrace) */ if (!function_exists('debug_print_backtrace')) { function debug_print_backtrace() { // Get backtrace $backtrace = debug_backtrace(); // Unset call to debug_print_backtrace array_shift($backtrace); // Iterate backtrace $calls = array(); foreach ($backtrace as $i => $call) { $location = $call['file'] . ':' . $call['line']; $function = (isset($call['class'])) ? $call['class'] . '.' . $call['function'] : $call['function']; $params = ''; if (isset($call['args'])) { $params = implode(', ', $call['args']); } $calls[] = sprintf('#%d %s(%s) called at [%s]', $i, $function, $params, $location); } echo implode("\n", $calls); } } ?>