Last active
July 22, 2016 14:13
-
-
Save hadamlenz/ce0914acfabe6dd0085889c2c1f633b0 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/* | |
*a wordpress funtion for dumping in a <pre> and dying | |
* | |
*param any $thing the thing you want to var_dump | |
*param bool $die = should we wp_die or just echo | |
*/ | |
function wp_predump($thing,$die=true){ | |
$output = '<pre>'; | |
ob_start(); | |
var_dump($thing); | |
$output .= ob_get_clean(); | |
$output .= '</pre>'; | |
if($die){ | |
wp_die($output); | |
}else{ | |
echo $output; | |
} | |
} | |
/*usage*/ | |
wp_predump($thing1,false); | |
wp_predump($thing2,false); | |
wp_predump($thing3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I often find myself writing the whole thing out so instead I made a function. I usually will put this in a utility class.