How to reset a variable to NULL in PHP?
As nacmartin said, unset
will "undefine" a variable. You could also set the variable to null, however this is how the two approaches differ:
$x = 3; $y = 4;
isset($x); // true;
isset($y); // true;
$x = null;
unset($y);
isset($x); // false
isset($y); // false
echo $x; // null
echo $y; // PHP Notice (y not defined)
Use unset($var);