Advertisement
puggan

print_r_html

Apr 11th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2.     function print_r_html($a, $return_insted_of_echo = FALSE, $tab_replacement = ' > ')
  3.     {
  4.         $output = nl2br(str_replace('    ', $tab_replacement, str_replace("\n\n", "\n", str_replace('<', '&lt;', str_replace('&', '&amp;', print_r($a, TRUE))))));
  5.         $output_test = preg_replace("#({$tab_replacement})+#", '<span style="opacity: 0.25;">\0</span>', $output);
  6.         if($output_test)
  7.         {
  8.             $output = $output_test;
  9.         }
  10.         if($output)
  11.         {
  12.             $output = "<span class='print_r'>{$output}</span>";
  13.         }
  14.         if($return_insted_of_echo)
  15.         {
  16.             return $output;
  17.         }
  18.         else
  19.         {
  20.             echo $output;
  21.         }
  22.     }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement