Last active
July 18, 2018 15:42
-
-
Save nateplusplus/0f5f9d60998eec9f0c6ceeb014e63a82 to your computer and use it in GitHub Desktop.
Simple php debugging helper function
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
/** | |
* Shortcut for print_r or var_dump while debugging | |
* @param $value (optional) - value, of any type, to print (providing nothing will result in weird face) | |
* @param bool $vardump (optional) - specify if you prefer var_dump instead of print_r | |
**/ | |
function peep($value = " ˁ(⦿ᴥ⦿)ˀ ", $vardump = false) | |
{ | |
echo '<pre>'; | |
if ($vardump || (empty($value) && $value !== 0 && $value !== "0")) { | |
var_dump($value); | |
} else { | |
print_r($value); | |
} | |
echo '</pre>'; | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment