Skip to content

Instantly share code, notes, and snippets.

@bMinaise
Created September 5, 2013 18:25
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 bMinaise/6454111 to your computer and use it in GitHub Desktop.
Save bMinaise/6454111 to your computer and use it in GitHub Desktop.
Output PHP data in 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