Know what’s going on with debug() function


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1.  
  2.  
  3.  
  4.  
  5. To make things even easier, I put this inside one function in my functions.php so it helps me a lot:
  6. 1 <?php
  7. 2 function debug($var) {
  8. 3 if ( ! is_string($var) ) {
  9. 4 echo "<pre>";
  10. 5 print_r($var);
  11. 6 echo "</pre>";
  12. 7 } else {
  13. 8 echo "DEBUG: ".$var;
  14. 9 }
  15. 10 }
  16. 11 ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.