Skip to content

Instantly share code, notes, and snippets.

@estadoactivo
Created November 8, 2013 10:44
Show Gist options
  • Save estadoactivo/7369334 to your computer and use it in GitHub Desktop.
Save estadoactivo/7369334 to your computer and use it in GitHub Desktop.
PHP debug code in browser console
<?php
/**
* Send debug code to the Javascript console
*/
function debug_to_console($data) {
if(is_array($data) || is_object($data))
{
echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
} else {
echo("<script>console.log('PHP: ".$data."');</script>");
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment