Last active
May 22, 2022 08:38
-
-
Save arixwap/39b07c8c57e3a299550282c9fe233290 to your computer and use it in GitHub Desktop.
PHP Data Dump Function - Inspired by Laravel & Symfony
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 | |
/** | |
* Data Dump & Exit | |
* | |
* @param any $data | |
* @param boolean $noExit | |
* @return string html pre tag | |
*/ | |
function dd($data, $noExit = false) { | |
echo "<pre>"; | |
print_r($data); | |
echo "</pre>"; | |
if ( ! $noExit ) { | |
exit(); | |
} | |
} | |
/** | |
* Var Dump & Exit | |
* | |
* @param any $data | |
* @param boolean $noExit | |
* @return string html pre tag | |
*/ | |
function vd($data, $noExit = false) { | |
echo "<pre>"; | |
var_dump($data); | |
echo "</pre>"; | |
if ( ! $noExit ) { | |
exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment