note 88470 added to function.print-r
| From: | sebasg37 at gmail dot com | Date: | Mon, 26 Jan 2009 05:35:59 +0000 |
| Subject: | note 88470 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149768@lists.php.net to get a copy of this message | ||
If you have to catch the output without showing it at all at first (for example, if you want to
append the print_r output to a file), you can do this:
<?php
ob_start();
print_r( $some_array );
$output = ob_get_clean();
// if you want to append the print_r output of $some_array to, let's say, log.txt:
file_put_contents( 'log.txt', file_get_contents( 'log.txt' ) . $output )
?>
----
Server IP: 201.216.232.3
Probable Submitter: 190.19.10.134
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/88470
Del: integrated -- https://master.php.net/note/delete/88470/integrated
Del: useless -- https://master.php.net/note/delete/88470/useless
Del: bad code -- https://master.php.net/note/delete/88470/bad+code
Del: spam -- https://master.php.net/note/delete/88470/spam
Del: non-english -- https://master.php.net/note/delete/88470/non-english
Del: in docs -- https://master.php.net/note/delete/88470/in+docs
Del: other reasons-- https://master.php.net/note/delete/88470
Reject -- https://master.php.net/note/reject/88470
Search -- https://master.php.net/manage/user-notes.php