Created
February 23, 2012 02:02
-
-
Save rugbyprof/1889184 to your computer and use it in GitHub Desktop.
print_r to a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//sebasg37 at gmail dot com | |
//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: | |
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 ) | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment