note 106245 added to function.print-r
| From: | eithed at osu1 dot php dot net | Date: | Fri, 21 Oct 2011 09:25:49 +0000 |
| Subject: | note 106245 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184040@lists.php.net to get a copy of this message | ||
Bear in mind that print_r actually reserves some memory to do something - so, for example thing
like:
<?php
function shutdown_handler()
{
file_put_contents($_SERVER['DOCUMENT_ROOT']."/log.txt", print_r($_REQUEST,
true));
}
ini_set('memory_limit', '1M');
register_shutdown_function("shutdown_handler");
$array = array();
while(true)
$array[] = new stdClass();
?>
will just not work. Try using var_export, and presto, everything is fine.
----
Server IP: 92.48.74.199
Probable Submitter: 86.162.17.17
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/106245
Del: integrated -- https://master.php.net/note/delete/106245/integrated
Del: useless -- https://master.php.net/note/delete/106245/useless
Del: bad code -- https://master.php.net/note/delete/106245/bad+code
Del: spam -- https://master.php.net/note/delete/106245/spam
Del: non-english -- https://master.php.net/note/delete/106245/non-english
Del: in docs -- https://master.php.net/note/delete/106245/in+docs
Del: other reasons-- https://master.php.net/note/delete/106245
Reject -- https://master.php.net/note/reject/106245
Search -- https://master.php.net/manage/user-notes.php