var_dump

Dumps information about a variable

Syntax

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

Parameters

value

The variable to dump.

values

More variables to dump.

Return

No value is returned.

Examples

value | bool

<?

$value = false;

var_dump($value);

?>
bool(false)

value | int

<?

$value = 0;

var_dump($value);

?>
int(0)

value | float

<?

$value = 0.0;

var_dump($value);

?>
float(0)

value | string

<?

$value = "0";

var_dump($value);

?>
string(1) "0"

value | array

<?

$value = array(0, 1, array(0, 1));

var_dump($value);

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

value | object | standard class

<?

$value = new stdclass;
$value->var = 0;

var_dump($value);

?>
object(stdClass)#1 (1) {
  ["var"]=>
  int(0)
}

value | object | custom class

<?

class myclass
{
    public $var;
}

$value = new myclass;
$value->var = 0;

var_dump($value);

?>
object(myclass)#1 (1) {
  ["var"]=>
  int(0)
}

values

<?

class myclass
{
    public $var;
}

$value1 = false;
$value2 = 0;
$value3 = 0.0;
$value4 = "0";
$value5 = array(0, 1, array(0, 1));
$value6 = new stdclass;
$value6->var = 0;
$value7 = new myclass;
$value7->var = 0;

var_dump($value1, $value2, $value3, $value4, $value5, $value6, $value7);

?>
bool(false)
int(0)
float(0)
string(1) "0"
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
}
object(stdClass)#1 (1) {
  ["var"]=>
  int(0)
}
object(myclass)#2 (1) {
  ["var"]=>
  int(0)
}

Internal

print_r

var_export

External

PHP

HomeMenu