← All built-ins / print_r()

print_r()

print_r(...$args): string

Parameters

NameTypeDescription
$vmixedvalue to render

Return value

Human-readable rendering of the value. Prints it AND returns the text (unlike PHP, where a second argument is needed for that).

Example

print_r(["a" => 1, "b" => [2, 3]]);
Array
(
  [a] => 1
  [b] => Array
  (
    [0] => 2
    [1] => 3
  )
)

See also

var_dump()var_export()