note 35437 deleted from function.debug-backtrace by cmb
| From: | cmb@php.net | Date: | Sun, 17 Nov 2019 08:32:35 +0000 |
| Subject: | note 35437 deleted from function.debug-backtrace by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213069@lists.php.net to get a copy of this message | ||
Note Submitter: Fabian dot Kraetzer at gmx dot de
----
I coded a function, too. Just call debug() evertime you think you could encounter an error:
<?
function debug()
{
$debug_array = debug_backtrace();
$counter = count($debug_array);
for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter)
{
?>
<table width="558" height="116" border="1"
cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td height="38" bgcolor="#D6D7FC"><font
color="#000000">function <font color="#FF3300"><?
echo($debug_array[$tmp_counter]["function"]);?>(</font> <font
color="#2020F0"><?
//count how many args a there
$args_counter = count($debug_array[$tmp_counter]["args"]);
//print them
for($tmp_args_counter = 0; $tmp_args_counter != $args_counter; ++$tmp_args_counter)
{
echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]);
if(($tmp_args_counter + 1) != $args_counter)
{
echo(", ");
}
else
{
echo(" ");
}
}
?></font><font
color="#FF3300">)</font></font></td>
</tr>
<tr>
<td bgcolor="#5F72FA"><font
color="#FFFFFF">{</font><br>
<font
color="#FFFFFF"> file: <?
echo($debug_array[$tmp_counter]["file"]);?></font><br>
<font
color="#FFFFFF"> line: <?
echo($debug_array[$tmp_counter]["line"]);?></font><br>
<font color="#FFFFFF">}</font></td>
</tr>
</table>
<?
if(($tmp_counter + 1) != $counter)
{
echo("<br>was called by:<br>");
}
}
exit();
}
?>