theitd

PHP debug to console

Mar 14th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Send debug code to the Javascript console
  4.  */
  5. function debug_to_console($data) {
  6.     if(is_array($data) || is_object($data))
  7.     {
  8.         echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
  9.     } else {
  10.         echo("<script>console.log('PHP: ".$data."');</script>");
  11.     }
  12. }
  13. ?>
Add Comment
Please, Sign In to add comment