note 31180 added to function.print-r
| From: | Bharat Mediratta | Date: | Sat, 12 Apr 2003 06:23:22 +0000 |
| Subject: | note 31180 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46535@lists.php.net to get a copy of this message | ||
Starting in PHP 4.3.0, print_r takes a second boolean argument that specifies whether the output is
printed out directly (the old behaviour) or returned. This isn't documented anywhere
('cept in the source code).
This means that in 4.3.0+ you can say:
$foo = array(1, 2, 3);
$foo_dump = print_r($foo, true);
whereas before 4.3.0 you had to use ob_start(), etc to capture the output.
--
http://www.php.net/manual/en/function.print-r.php
http://master.php.net/manage/user-notes.php?action=edit+31180
http://master.php.net/manage/user-notes.php?action=delete+31180
http://master.php.net/manage/user-notes.php?action=reject+31180