php var_dump in console code example
Example 1: php print to console
<script>
console.log(<?= json_encode($foo); ?>);
</script>
Example 2: php console print
$a = array(
null => 'a',
true => 'b',
false => 'c',
0 => 'd',
1 => 'e',
'' => 'f'
);
echo count($a), "\n";