puggan icon

print_r_html

puggan | PRO | 04/11/14 02:48:18 PM UTC | 0 ⭐ | 595 👁️ | Never ⏰ | []
PHP |

590 B

|

None

|

0 👍

/

0 👎

<?php
    function print_r_html($a, $return_insted_of_echo = FALSE, $tab_replacement = ' > ')
    {
        $output = nl2br(str_replace('    ', $tab_replacement, str_replace("\n\n", "\n", str_replace('<', '&lt;', str_replace('&', '&amp;', print_r($a, TRUE))))));
        $output_test = preg_replace("#({$tab_replacement})+#", '<span style="opacity: 0.25;">\0</span>', $output);
        if($output_test)
        {
            $output = $output_test;
        }
        if($output)
        {
            $output = "<span class='print_r'>{$output}</span>";
        }
        if($return_insted_of_echo)
        {
            return $output;
        }
        else
        {
            echo $output;
        }
    }
?>

Comments