Menu Riverview Church

PRINT_R

Prints human-readable information about a variable

SYNTAX

print_r ( mixed $expression [, bool $return = FALSE ] ) : mixed

PARAMETERS

expression

The expression to be printed.

return

If you would like to capture the output of print_r(), use the return parameter. When this parameter is set to TRUE, print_r() will return the information rather than print it.

RETURN

If given a string, integer or float, the value itself will be printed. If given an array, values will be presented in a format that shows keys and elements. Similar notation is used for objects. When the return parameter is TRUE, this function will return a string. Otherwise, the return value is TRUE.

EXAMPLES

EXPRESSION | BOOL


EXPRESSION | INT

0

EXPRESSION | FLOAT

0

EXPRESSION | STRING

0

EXPRESSION | ARRAY

Array
(
    [0] => 0
    [1] => 1
    [2] => Array
        (
            [0] => 0
            [1] => 1
        )

)

EXPRESSION | OBJECT | STANDARD CLASS

stdClass Object
(
    [var] => 0
)

EXPRESSION | OBJECT | CUSTOM CLASS

myclass Object
(
    [var] => 0
)

RETURN | TRUE

myclass Object
(
    [var] => 0
)

RETURN | FALSE

myclass Object
(
    [var] => 0
)
true

INTERNAL

var_dump

var_export

EXTERNAL

PHP