Created
January 7, 2016 20:32
-
-
Save arianimartins/704a70336be3812d83cf to your computer and use it in GitHub Desktop.
Print messages in browser console
This file contains 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 | |
function debug_to_console( $data ) { | |
if ( is_array( $data ) ) | |
$output = "<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>"; | |
else | |
$output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>"; | |
echo $output; | |
} | |
debug_to_console('Text'); | |
debug_to_console($something); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment