Last active
August 29, 2015 14:06
-
-
Save TheHiddenHaku/60b029594ba92f89bdc3 to your computer and use it in GitHub Desktop.
PHP - Function to log data in javascript console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //UTILITY TO CONSOLE LOG DEBUG OUTPUT | |
| function console_log($data, $table = 0) { | |
| $verb = $table ? 'table' : 'log'; | |
| if(is_array($data) || is_object($data)) { | |
| echo "<script>console.".$verb."(".json_encode($data).");</script>" ; | |
| } else { | |
| echo "<script>console.".$verb."(".$data.");</script>" ; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment