var_dump()

var_dump() — Dumps information about a variable.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure.

Signature

var_dump(mixed $value, mixed ...$values): void

Parameters

ParameterTypeWhat it takes
$valuemixedThe expression to dump.
...$valuesmixedFurther expressions to dump.

Return value

No value is returned.

Example

A runnable snippet:

$a = array(1, 2, array("a", "b", "c")); var_dump($a);

Output:

array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } }

See also

print_r(), debug_zval_dump(), var_export()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page var_dump() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.