note 102499 added to debugger
| From: | mortensickel at osu1 dot php dot net | Date: | Thu, 17 Feb 2011 18:39:40 +0000 |
| Subject: | note 102499 added to debugger | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177089@lists.php.net to get a copy of this message | ||
In my debug function I added some functionallity to print out from where the function was called:
function debug($value=''){
$btr=debug_backtrace();
$line=$btr[0]['line'];
$file=basename($btr[0]['file']);
print"<pre>$file:$line</pre>\n";
if(is_array($value)){
print"<pre>";
print_r($value);
print"</pre>\n";
}elseif(is_object($value)){
$value.dump();
}else{
print("<p>>${value}<</p>");
}
}
Thereby it is easy to keep the overview if you debug more variables simultaneously or, if the
program crashes somewhere, just throw in a few debug() and you'll easily see how far the
program comes
----
Server IP: 69.147.83.197
Probable Submitter: 193.90.59.42
----
Manual Page -- http://www.php.net/manual/en/debugger.php
Edit -- https://master.php.net/note/edit/102499
Del: integrated -- https://master.php.net/note/delete/102499/integrated
Del: useless -- https://master.php.net/note/delete/102499/useless
Del: bad code -- https://master.php.net/note/delete/102499/bad+code
Del: spam -- https://master.php.net/note/delete/102499/spam
Del: non-english -- https://master.php.net/note/delete/102499/non-english
Del: in docs -- https://master.php.net/note/delete/102499/in+docs
Del: other reasons-- https://master.php.net/note/delete/102499
Reject -- https://master.php.net/note/reject/102499
Search -- https://master.php.net/manage/user-notes.php