unset
Description
The unset of Variable Handling for PHP unset a given variable.
Syntax
unset ( mixed $var [, mixed $... ] ) : void
Parameters
var
The variable to be unset.
...
Another variable ...
Return
No value is returned.
Examples
1
<? $var = 1; unset($var); var_dump($var);
NULL
2
<? $var1 = 1; $var2 = 2; $var3 = 3; unset($var1, $var2, $var3); var_dump($var1, $var2, $var3);
NULL NULL NULL
3
<? $var = array(0, 1, 2); unset($var); var_dump($var);
NULL
4
<? $var = array(0, 1, 2); unset($var[1]); print_r($var);
Array ( [0] => 0 [2] => 2 )
5
<? $var = array("a" => 0, "b" => 1, "c" => 2); unset($var["b"]); print_r($var);
Array ( [a] => 0 [c] => 2 )
Links
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
- var_dump
- var_export