Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. function dbg($var, $mode = 0, $html = 0) {
  4.  
  5. if ($mode) {
  6. if ($html) {
  7. echo '<pre>'; var_dump($var); echo '</pre>';
  8. } else {
  9. var_dump($var);
  10. }
  11. } else {
  12. if ($html) {
  13. echo '<pre>'; print_r($var); echo '</pre>';
  14. } else {
  15. print_r($var);
  16. }
  17. }
  18. }
  19.  
  20. dbg($_SERVER, 0, 0); // print_r for console
  21. dbg($_SERVER, 0, 1); // print_r for browser
  22. dbg($_SERVER, 1, 0); // var_dump for console
  23. dbg($_SERVER, 1, 1); // var_dump for browser
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement