PHP function var_dump()

Availability in PHP 4.0

Prints variable information directly to the output (page).

Parameters

Parameter Data type Default value Note
$expression mixed not Variable to be output
$_ mixed null

Return values

void

The function returns nothing. It renders the output directly to the page like echo.

php
var_dump('I like PHP'); // string(13) "I like PHP"

Example of a more complex structure:

php
var_dump([1, 2, 3]);

Returns the following:

array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}

Other resources

Official var-dump documentation

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.