function 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.

Parameters

mixed $input: The input that should be printed or returned.

boolean $return: (optional) Indicates of the result should be returned instead of printed. The default is to print it.

string $name: (optional) The label to apply.

string $function: (optional) The function to use for output. The defualt is print_r().

boolean $check: (optional) Indicates if the output should be run through check_plain(). The default is TRUE.

Return value

The formatted output if $return is TRUE.

5 calls to dprint_r()
devel_shutdown_query in ./devel.module
Returns the rendered query log.
dpr in ./devel.module
An alias for dprint_r().
dvm in ./devel.module
Displays a drupal_var_export() variable to the 'message' area of the page.
dvr in ./devel.module
Like dpr(), but uses drupal_var_export() instead.
kprint_r in ./devel.module
Returns a message using Krumo.

File

./devel.module, line 2081

Code

function dprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r', $check = TRUE) {
    if (user_access('access devel information')) {
        if ($name) {
            $name .= ' => ';
        }
        if ($function == 'drupal_var_export') {
            include_once DRUPAL_ROOT . '/includes/utility.inc';
            $output = drupal_var_export($input);
        }
        else {
            ob_start();
            $function($input);
            $output = ob_get_clean();
        }
        if ($check) {
            $output = check_plain($output);
        }
        if (is_array($input) && 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;
        }
    }
}