Skip to content

Instantly share code, notes, and snippets.

@craiga
Last active October 4, 2015 21:07
Show Gist options
  • Save craiga/2699763 to your computer and use it in GitHub Desktop.
Save craiga/2699763 to your computer and use it in GitHub Desktop.
_logDump
<?php
/**
* Dump the output of var_dump to a log file.
*
* Dump the output of var_dump to a log file. Requires {@link https://gist.github.com/1849563 this _log function}.
*
* @author Craig Anderson <[email protected]>
* @link https://gist.github.com/gists/2699763
*/
protected function _logDump($var)
{
$originalSetting = ini_get("xdebug.overload_var_dump");
if(!ini_set("xdebug.overload_var_dump", false))
{
// Couldn't override the xdebug.overload_var_dump setting; ignore.
}
ob_start();
var_dump($var);
$dump = ob_get_clean();
ini_set("xdebug.overload_var_dump", $originalSetting);
$this->_log($var);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment