Created
July 26, 2017 06:58
-
-
Save adamcjoiner/a5e159c7a46526dd47101d3518513f26 to your computer and use it in GitHub Desktop.
Send PHP debug message to Javascript console
This file contains hidden or 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 | |
| /** | |
| * Output debug message to browser 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