Last active
December 14, 2015 23:49
-
-
Save tomsseisums/5168218 to your computer and use it in GitHub Desktop.
`dump()` is a debugging helper that mimics the output of `var_dump()` wrapped in `<pre/>` and then returned as a string. I made the function because I hate that var_dump() echoes directly and may consume the overall page style. This gives me the good old var_dump() which I can then pass directly into my logging mechanisms, or even pass to backed…
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 | |
/** | |
* Returns a string containing var_dump() for each argument wrapped in a <pre> | |
* | |
* @author joltmode | |
* @return string | |
*/ | |
function dump() | |
{ | |
$arguments = func_get_args(); | |
ob_start(); | |
foreach ($arguments as $argument) var_dump( $argument ); | |
return '<pre>' . ob_get_clean() . '</pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment