php code to echo in console code example
Example: php console log
// Assuming you are wishing to log to the JS Console...
<?php
function consoleLog($msg) {
echo '<script type="text/javascript">' .
'console.log(' . $msg . ');</script>';
}
consoleLog('Hello, console!');
?>