Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholasruunu/a01f0db119515d8f2e5d to your computer and use it in GitHub Desktop.
Save nicholasruunu/a01f0db119515d8f2e5d to your computer and use it in GitHub Desktop.
if ( ! function_exists('dd'))
{
/**
* Dump the passed variables and end the script.
*
* @param mixed
* @return void
*/
function dd()
{
$backtrace = debug_backtrace()[0];
$fileInfo = 'File: ' . $backtrace['file'] . ':' . $backtrace['line'] . PHP_EOL;
echo PHP_SAPI === 'cli' ? $fileInfo : nl2br($fileInfo);
array_map(function($x) { var_dump($x); }, func_get_args()); die;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment