note 68027 deleted from function.print-r by philip
| From: | philip@php.net | Date: | Tue, 11 Jul 2006 06:30:28 +0000 |
| Subject: | note 68027 deleted from function.print-r by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114652@lists.php.net to get a copy of this message | ||
Note Submitter: shmohel at gmail dot com
Reason: useless
----
jcarouth,
The reason I don't like doing that is because print_r displays the output at the point in the
script where it is called. I much prefer to store this in a variable, so I can have it printed
wherever in the script I want it to be.
<?php
$html="<div>Info to display to browser.";
$html.=showarr($myarray);
$html.="</div>";
echo $html;
?>
This function comes in very handy when I use a template system which builds bits of the page and
them determines which order to out put them. Otherwise, I end up with the array outside of my
template.