5 Answers
dpm() prints a variable to the ‘message’ area of the page using drupal_set_message(). The output and compact and less likely to break the layout of your page.
From the devel docs:
A note from the devel module: dsm() is a legacy function that was poorly named; use dpm() instead, since the 'p' maps to 'print_r'.
I think we should trust the devel folks on that one.
drupal_set_message()
is a Drupal core function that sets messages to be output on the next page view. drupal_print_message()
is, I believe (based on the examples I found in Google), something people occasionally say by accident when they actually mean drupal_set_message()
, but not a real function.
Note: there is a dpm()
function in the Devel module, which is short for "drupal print message" that outputs variables for development debugging.
-
Edited my question for clarification. I am using devel. Commented Oct 28, 2010 at 22:33
They're all the same, check how dsm()
is defined (one is calling another):
function dsm($input, $name = NULL) {
return dpm($input, $name);
}
So the main one which should be used is dpm()
, as dsm()
is deprecated.
Devel Demo is a good drupal module that demonstrate the most of the debugging functions provided by devel module and here is a good post which gives a brief overview of those functions.
-
you need to include the relevant information in your answer, not just link to offsite resources.– DrCordCommented Jan 8, 2016 at 19:10