I was browsing around the Devel Module the other day and I noticed a few functions that are not mentioned in any documentation that I've seen but make life even easier, as if Devel doesn't make it easy enough! Almost everyone that's used Devel will be familiar with
<strong>dprint</strong>_r (A debug version of the popular
print_r function in PHP). Well who has used these ones?
dpr– Shortcut for
dvr– Similar to
dpr, but uses
dpm– Similar to
print_r's a variable as a message using
dvm– Similar to
dpr simply "saves carpal tunnel syndrome" (as the comment for the function in devel.module says) and the
dvr function is funky useful as it not only dumps the data but also the data TYPE too (eg, is this variable a integer zero or boolean false?). The
dvm functions are useful as the message only gets printed out on a visible page. This makes form output debuging easier.
Who here has debug outputted the
$form_values on a form_submit and spent a few minutes wondering why nothing came up (due to the redirect after submit) and then ended up adding
exit calls to the code to see the output or enabling the form redirection interruption from the Devel Module? Well if you use
dvm then you will get the form output in a message on the next visible page without any workflow interruption! Cool, eh!
These are REALLY useful commands! Thanks to Moshe for adding the
var_dump variants and I can only assume it was Moshe's idea to have the shortcut
dpm functions to start with!