Skip to content

Instantly share code, notes, and snippets.

@NickBusey
Last active August 29, 2015 14:09
Show Gist options
  • Save NickBusey/5645ec50564db82750f1 to your computer and use it in GitHub Desktop.
Save NickBusey/5645ec50564db82750f1 to your computer and use it in GitHub Desktop.
function dbg($input) {
echo "<pre>";
print_r($input);
}
function dbgd($input='--Die--') {
dbg($input);
die();
}
@NickBusey
Copy link
Author

These are the first bits of code I paste into any new PHP project, whatever platform it's written in. I usually put them in the very first bit of PHP that gets loaded on the webserver. For CakePHP 3+ that's in app/webroot/index.php

Now anytime you want to debug something just: dbg($OUTPUT);

If you want to debug something and stop what's happening afterwards: dbgd($OUTPUT);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment