Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Created December 22, 2013 21:43
Show Gist options
  • Select an option

  • Save jeremyckahn/8088780 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyckahn/8088780 to your computer and use it in GitHub Desktop.
Function for var_dump'ing anything into into PHP's error log.
<?php
// Adapted from: http://www.nolte-schamm.za.net/2011/05/php-var_dump-into-error-console_log/
function console_log ($obj) {
ob_start();
var_dump($obj);
$contents = ob_get_contents();
ob_end_clean();
error_log($contents);
}
?>
@jmhughesatbyu
Copy link
Copy Markdown

Love this bit of code. Use it all the time. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment