note 50713 added to function.debug-print-backtrace
| From: | Justinatwww dot mpsunlimited dot com at osu1 dot php dot net | Date: | Tue, 08 Mar 2005 00:31:54 +0000 |
| Subject: | note 50713 added to function.debug-print-backtrace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86078@lists.php.net to get a copy of this message | ||
That one gives an error if there are no args, here is one that will not:
(this one returns the string instead of echoing it)
if (!function_exists('debug_print_backtrace'))
{
function debug_print_backtrace()
{
if (isset($_SERVER['REQUEST_URI']))
{
$eol = '<br />' . "\n";
}
else
{
$eol = "\n";
}
$arr = debug_backtrace();
$dum = array_shift($arr);
$ret = '';
for ($i=0; $i < count($arr); $i++)
{
$v = $arr[$i];
$fileLoc = $v['file'] . ':' . $v['line'];
$function = (isset($v['class'])) ? $v['class'] . '.' .
$v['function'] : $v['function'];
$params = "";
if (isset($v['args']))
{
for ($j=0; $j < count($v['args']); $j++)
{
$p = $v['args'][$j];
$params .= ($params) ? ",$p" : $p;
}
}
$ret .= "#$i. $function($params) called at [$fileLoc]$eol";
}
return $ret;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.debug-print-backtrace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50713
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50713&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50713&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50713&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50713&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50713&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50713&report=yes
Search -- http://master.php.net/manage/user-notes.php