Last active
August 29, 2015 14:07
-
-
Save BrendanNeufeld/7a0391b0f1398357ebf6 to your computer and use it in GitHub Desktop.
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
//source: http://www.paulund.co.uk/output-php-data-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