note 96859 added to function.print-r
| From: | Alexander at osu1 dot php dot net | Date: | Fri, 19 Mar 2010 13:20:36 +0000 |
| Subject: | note 96859 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167197@lists.php.net to get a copy of this message | ||
A simple function to send the output of print_r to firebug.
The script creates a dummy console object with a log method for when firebug is disabled/not
available.
function debug ($data) {
echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}";
$output = explode("\n", print_r($data, true));
foreach ($output as $line) {
if (trim($line)) {
$line = addslashes($line);
echo "console.log(\"{$line}\");";
}
}
echo "\r\n//]]>\r\n</script>";
}
----
Server IP: 69.147.83.197
Probable Submitter: 82.95.118.232
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/96859
Del: integrated -- https://master.php.net/note/delete/96859/integrated
Del: useless -- https://master.php.net/note/delete/96859/useless
Del: bad code -- https://master.php.net/note/delete/96859/bad+code
Del: spam -- https://master.php.net/note/delete/96859/spam
Del: non-english -- https://master.php.net/note/delete/96859/non-english
Del: in docs -- https://master.php.net/note/delete/96859/in+docs
Del: other reasons-- https://master.php.net/note/delete/96859
Reject -- https://master.php.net/note/reject/96859
Search -- https://master.php.net/manage/user-notes.php