2

The devel module in drupal allows us to print variable data using functions like: kpr,krumo,dpm,dsm Can anyone please explain how different is each function from the other

1 Answer 1

4

Maybe this can help you a bit:

  • dpm($var) or dsm($var) - displays the information about a variable in the form of system messages using Krumo.
  • dvm($var) - displays the information about a variable in the form of system messages using var_dump($var).
  • dpr($var, $return = false) - displays the information about a variable at the top of the page, using print_r($var, $return).
  • dvr($var, $return = false) - displays information about a variable at the top of the page, using var_dump($var, $return).
  • kpr($var, $return = false) - displays the information about a variable at the top of the page using Krumo.
  • dargs() - displays information about the arguments of the current function at the top of the page using Krumo.
  • dd($var, $label = null) - writes the information about a variable in the file drupal_debug.txt, which is located in the temporary directory (admin/settings/file-system).
  • ddebug_backtrace() - displays the call stack at the top of the page using Krumo.
  • db_queryd($query, $args = array()) - this is a debug version of db_query(), which displays it at the top of the page after the execution of $query.
  • dpq($query, $return = FALSE, $name = NULL) - this is an analog to the function db_queryd() only available in Drupal 7. Outputs SQL query using dpm() with substituted arguments. The first parameter takes an object DBTNG.
2
  • yeah but which one is more favorable to use. Do all of them output the same content Commented Oct 13, 2014 at 1:47
  • @JasjyotSinghJaswal The functions you mentioned on the question will output the same content in different formats. It will output whatever you put between (). The answer sais it all and even has links to php manual if you don't know what the function does. If you don't want to chose, go with krumo() and you'll be fine. Commented Dec 7, 2014 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.