how to print in php to the browswe console code example
Example 1: console.log in php
/*
console.log in php
*/
<?php
function consoleLog($message) {
echo '<script type="text/javascript">' .
'console.log(' . $message . ');</script>';
}
consoleLog('Hello, greppers!');
?>
Example 2: php print to console
<script>
console.log(<?= json_encode($foo); ?>);
</script>