note 51076 deleted from function.print-r by derick
| From: | derick@php.net | Date: | Thu, 27 Oct 2005 10:15:17 +0000 |
| Subject: | note 51076 deleted from function.print-r by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97670@lists.php.net to get a copy of this message | ||
Note Submitter: cmadole [at] jamspiritsites [dot] com
----
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;
}
}
?>