Name
unset()
Synopsis
void unset ( mixedvar
[, mixedvar
[, mixed ...]] )
The unset()
function deletes a variable so that isset()
will return false. Once deleted, you can recreate a variable later on in a script.
$name = "Paul"; if (isset($name)) print "Name is set\n"; unset($name); if (isset($name)) print "Name is still set\n";
That would print out "Name is set", but not "Name is still set", because calling unset()
has deleted the $name
variable.
Get PHP in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.