note 36179 added to function.print-r
| From: | stacy at edit-x dot com | Date: | Mon, 29 Sep 2003 20:52:58 +0000 |
| Subject: | note 36179 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57290@lists.php.net to get a copy of this message | ||
If you ever need to store the print_r() result into a variable here is how...
// print array
function print_array($array) {
ob_start();
$restore = ob_get_contents();
ob_end_clean();
ob_start();
print_r($array);
$output = ob_get_contents();
ob_end_clean();
ob_start();
echo $restore;
return $output;
}
this is useful for debugging functions and classes.
__
R. Stacy Cook
Edit-X :: Control Your Content
http://www.edit-x.com
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36179
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36179&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36179&report=yes