Skip to content

Instantly share code, notes, and snippets.

@melissacabral
Created June 24, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melissacabral/260f577e4d5bed3f9cf54443d49c8741 to your computer and use it in GitHub Desktop.
Save melissacabral/260f577e4d5bed3f9cf54443d49c8741 to your computer and use it in GitHub Desktop.
Helper function to allow PHP to use the console for debugging.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment