You are here

function dprint_r in Devel 6

Same name and namespace in other branches
  1. 5 devel.module \dprint_r()
  2. 7 devel.module \dprint_r()

Pretty-print a variable to the browser (no krumo). Displays only for users with proper permissions. If you want a string returned instead of a print, use the 2nd param.

5 calls to dprint_r()
devel_shutdown_real in ./devel.module
See devel_shutdown() which registers this function as a shutdown function. Displays developer information in the footer.
dpr in ./devel.module
An alias for dprint_r(). Saves carpal tunnel syndrome.
dvm in ./devel.module
Var_dump() a variable to the 'message' area of the page. Uses drupal_set_message()
dvr in ./devel.module
Like dpr, but uses var_dump() instead
kprint_r in ./devel.module

File

./devel.module, line 1913

Code

function dprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r', $check = TRUE) {
  if (user_access('access devel information')) {
    if ($name) {
      $name .= ' => ';
    }
    ob_start();
    $function($input);
    $output = ob_get_clean();
    if ($check) {
      $output = check_plain($output);
    }
    if (count($input, COUNT_RECURSIVE) > DEVEL_MIN_TEXTAREA) {

      // don't use fapi here because sometimes fapi will not be loaded
      $printed_value = "<textarea rows=30 style=\"width: 100%;\">\n" . $name . $output . '</textarea>';
    }
    else {
      $printed_value = '<pre>' . $name . $output . '</pre>';
    }
    if ($return) {
      return $printed_value;
    }
    else {
      print $printed_value;
    }
  }
}