Skip to content

Instantly share code, notes, and snippets.

@arixwap
Last active May 22, 2022 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arixwap/39b07c8c57e3a299550282c9fe233290 to your computer and use it in GitHub Desktop.
Save arixwap/39b07c8c57e3a299550282c9fe233290 to your computer and use it in GitHub Desktop.
PHP Data Dump Function - Inspired by Laravel & Symfony
<?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