Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Last active December 13, 2015 19:18
Show Gist options
  • Select an option

  • Save jehoshua02/4961990 to your computer and use it in GitHub Desktop.

Select an option

Save jehoshua02/4961990 to your computer and use it in GitHub Desktop.
Sometimes it's annoying to try to find those var_dump()'s
<?php
/**
* Dumps a value with the file and line number where dump was called
*
* @params mixed $value Value to dump
* @params mixed $dumpFunction The function name or closure used to dump the value. Default to var_dump()
*/
function dump($value, $dumpFunction = 'var_dump') {
$trace = array_shift(debug_backtrace());
echo "\n\ndump ({$trace['file']} +{$trace['line']}):\n";
$dumpFunction($value);
echo "\nend dump\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment