Advertisement
phpaddict

Pretty print

Jul 9th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. // printing a variable without the need to view source (firefox)
  2.  
  3. function print_a($var, $exit = FALSE)
  4. {
  5.     print_r("\n");
  6.     print_r("<pre>");
  7.     print_r($var);
  8.     print_r("</pre>");
  9.     if ($exit !== FALSE)
  10.     {
  11.         exit;
  12.     }
  13.     print_r("\n");
  14. }
  15.  
  16. // this will print event the html tags
  17. function print_b($var, $exit = FALSE)
  18. {
  19.     ob_start();
  20.     print_r($var);
  21.     $print_r = ob_get_contents();
  22.     ob_end_clean();
  23.  
  24.     print_r("\n");
  25.     print_r("<pre>");
  26.     print_r(htmlentities($print_r, ENT_QUOTES, 'UTF-8'));
  27.     print_r("</pre>");
  28.     if ($exit !== FALSE)
  29.     {
  30.         exit;
  31.     }
  32.     print_r("\n");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement