note 97540 rejected from function.print-r by visualmind

From: Date: Sun, 25 Apr 2010 08:01:16 +0000
Subject: note 97540 rejected from function.print-r by visualmind
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168613@lists.php.net to get a copy of this message
Note Submitter: mikeytown2 ---- <?php echo str_replace(' ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(htmlentities(print_r($variable, TRUE)))); ?> What to use when one needs the output of print_r as html. In the above example $variable is the array. Functions used http://php.net/htmlentities - Convert ">" to "&gt;" http://php.net/nl2br - Convert "\n" to "<br>" http://php.net/str_replace - Convert 4 spaces to 4 non breaking spaces

« previous php.notes (#168613) next »