note 97540 added to function.print-r
| From: | mikeytown2 at osu1 dot php dot net | Date: | Sun, 25 Apr 2010 07:34:36 +0000 |
| Subject: | note 97540 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168612@lists.php.net to get a copy of this message | ||
<?php
echo str_replace(' ', ' ',
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
">"
http://php.net/nl2br - Convert "\n" to
"<br>"
http://php.net/str_replace - Convert 4 spaces to 4 non
breaking spaces
----
Server IP: 69.147.83.197
Probable Submitter: 24.16.70.195
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/97540
Del: integrated -- https://master.php.net/note/delete/97540/integrated
Del: useless -- https://master.php.net/note/delete/97540/useless
Del: bad code -- https://master.php.net/note/delete/97540/bad+code
Del: spam -- https://master.php.net/note/delete/97540/spam
Del: non-english -- https://master.php.net/note/delete/97540/non-english
Del: in docs -- https://master.php.net/note/delete/97540/in+docs
Del: other reasons-- https://master.php.net/note/delete/97540
Reject -- https://master.php.net/note/reject/97540
Search -- https://master.php.net/manage/user-notes.php