Last active
October 13, 2015 12:37
-
-
Save niczak/4196906 to your computer and use it in GitHub Desktop.
Extend error_log() capability with output buffering
This file contains 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 | |
// create dummy array for example | |
$array = array("one", "two", "three"); | |
// turn on output buffering | |
ob_start(); | |
// use var_dump to output the contents of the array/object | |
var_dump($array); | |
// store current output buffer contents and delete buffer | |
$string = ob_get_clean(); | |
// pipe the value of $string to the error_log() function | |
error_log($string); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment