Last active
December 13, 2015 19:18
-
-
Save jehoshua02/4961990 to your computer and use it in GitHub Desktop.
Sometimes it's annoying to try to find those var_dump()'s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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