note 51076 added to function.print-r
| From: | cmadole | Date: | Fri, 18 Mar 2005 21:06:42 +0000 |
| Subject: | note 51076 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86664@lists.php.net to get a copy of this message | ||
I've found this to be handy adaptation of print_r for outputing arrays to a browser; it saves
you from having to look at the source code.
<?php
function html_print_r($object, $returnValue = false) {
$output = print_r($object, true);
$output = htmlentities($output);
$output = str_replace(" ", " ", );
$output = nl2br($output);
if ($returnValue) {
return $output;
} else {
echo $output;
return true;
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51076
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51076&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51076&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51076&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51076&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51076&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51076&report=yes
Search -- http://master.php.net/manage/user-notes.php