Skip to content

Instantly share code, notes, and snippets.

@nateplusplus
Last active July 18, 2018 15:42
Show Gist options
  • Save nateplusplus/0f5f9d60998eec9f0c6ceeb014e63a82 to your computer and use it in GitHub Desktop.
Save nateplusplus/0f5f9d60998eec9f0c6ceeb014e63a82 to your computer and use it in GitHub Desktop.
Simple php debugging helper function
/**
* 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