Skip to content

Instantly share code, notes, and snippets.

View k9t9's full-sized avatar

k9t9 k9t9

  • Shenzen // Berlin // Milano // Hong Kong
View GitHub Profile
@k9t9
k9t9 / send-print_r-to-firebug-console.php
Created August 5, 2017 04:23 — forked from technoknol/send-print_r-to-firebug-console.php
Send print_r to Firebug Console.log
<?php
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}\");";
}