Skip to content

Instantly share code, notes, and snippets.

@niczak
Last active October 13, 2015 12:37
Show Gist options
  • Save niczak/4196906 to your computer and use it in GitHub Desktop.
Save niczak/4196906 to your computer and use it in GitHub Desktop.
Extend error_log() capability with output buffering
<?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