<?php function console_log($object){ echo "<script>console.log(".json_encode(var_export($object, true)).");</script>"; } console_log('wow!'); ?>