PHP browser Debugger
Function to be included in functions list:
Usage:
Just open browser console to use this tool.
Function to be included in functions list:
PHP Code:
function console_log()
{
$args = func_get_args();
$argsSize = count($args);
if ($argsSize == 0)
{
return false;
}
if ($argsSize == 1)
{
$output = sprintf($args[0]);
}
else
{
$output = call_user_func_array('sprintf', $args);
}
$output = str_replace(array("\r", "\n"), '', $output);
echo '<script type="text/javascript"> if ( ! window.console) console = {}; console.log = console.log || function(name, data){}; console.log("'.$output.'"); </script>';
}
PHP Code:
class Test
{
private $test = 2;
}
console_log(print_r(new Test(), true));
$day = 21;
console_log("%d %s %d", $day, 'Dec', 2004);
console_log("Code at line %d .", __LINE__);
console_log(print_r($days, true));
echo 'Hellow world!';
Comment