var_dump
Description
The var_dump of Variable Handling for PHP dumps information about a variable.
Syntax
var_dump( mixed $value, mixed ...$values ): void
Parameters
value
The expression to dump.
values
Further expressions to dump.
Return
No value is returned.
Examples
1 · value · bool
<? $value = false; var_dump($value); ?>
bool(false)
2 · value · int
<? $value = 0; var_dump($value); ?>
int(0)
3 · value · float
<? $value = 0.0; var_dump($value); ?>
float(0)
4 · value · string
<? $value = "0"; var_dump($value); ?>
string(1) "0"
5 · 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) } }
6 · value · object · standard class
<? $value = new stdclass; $value->var = 0; var_dump($value); ?>
object(stdClass)#1 (1) { ["var"]=> int(0) }
7 · value · object · custom class
<? class myclass { public $var; } $value = new myclass; $value->var = 0; var_dump($value); ?>
object(myclass)#1 (1) { ["var"]=> int(0) }
8 · 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) }
Links
Related
Variable Handling
- boolval
- debug_zval_dump
- doubleval
- empty
- floatval
- get_debug_type
- get_defined_vars
- get_resource_id
- get_resource_type
- gettype
- intval
- is_array
- is_bool
- is_callable
- is_countable
- is_double
- is_float
- is_int
- is_integer
- is_iterable
- is_long
- is_null
- is_numeric
- is_object
- is_real
- is_resource
- is_scalar
- is_string
- isset
- print_r
- serialize
- settype
- strval
- unserialize
- unset
- var_export