HIRE US

Let us help you with your Drupal requirements

To prevent automated spam submissions leave this field empty.

Drupal’s Devel module provides a wide range of functionalities that make a Drupal developer’s life much saner. Of these, the most useful one is the function dpm() which seems to have a twin clone - dsm().

For those who are unaware, dpm() is a highly useful function for neatly printing (pretty printing) arrays/objects etc in drupal. There is also a function dsm() in the devel module, which seems to do the same thing.

Then which is the correct one?

Quick Answer: Use dpm().

Here’s the long answer:
Drupal’s Devel module provides a wide range of functionalities that make a Drupal developer’s life much saner. Of these, the most useful one is the function dpm() which seems to have a twin clone - dsm().

For those who are unaware, dpm() is a highly useful function for neatly printing (pretty printing) arrays/objects etc in drupal. There is also a function dsm() in the devel module, which seems to do the same thing.

Then which is the correct one? The answer is, dpm().
dsm() is kept just for legacy sake. It just sits there in devel module and calls dpm() when invoked.

From devel.module:

// legacy function that was poorly named. use dpm() instead
// since the 'p' maps to 'print_r'

function dsm($input, $name = NULL) {
  dpm($input, $name);
}

Post your comments / questions