1<?php
2function console_log($output, $with_script_tags = true) {
3 $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
4');';
5 if ($with_script_tags) {
6 $js_code = '<script>' . $js_code . '</script>';
7 }
8 echo $js_code;
9}