Skip to content

Instantly share code, notes, and snippets.

@porty
Created March 28, 2017 00:36
Show Gist options
  • Save porty/97e8f4cc2a9d05fa60bf4e92d90906e6 to your computer and use it in GitHub Desktop.
Save porty/97e8f4cc2a9d05fa60bf4e92d90906e6 to your computer and use it in GitHub Desktop.
How to debug in php
<?php
private function log($args)
{
$str = '';
foreach ($args as $arg) {
if (is_string($arg)) {
$str .= $arg;
} else {
ob_start();
var_dump($arg);
$str .= ob_get_clean();
}
}
$str .= "\n";
file_put_contents('/some-mount-point-shared-with-host/log.log', $str, FILE_APPEND);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment