php debug echo code example
Example 1: console_log in php
<?php
function console_log($output, $with_script_tags = true) {
$js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
');';
if ($with_script_tags) {
$js_code = '<script>' . $js_code . '</script>';
}
echo $js_code;
}
Example 2: debug php
$a = 123
echo ($a);
exit;
$array = array(
1 => 'apple',
2 => 'banana',
)
echo "<pre>";
print_r($array);
echo "</pre>";
echo "<pre>";
var_dump($array);
echo "</pre>";
dd($array)
pr ($array);
$json = {"a":"123"}
pr (json_encode($json));
exit;
print_r (json_encode($json));
exit;