PHP unset() Function is used to unset a variable. PHP unset() function is PHP built-in function.
It unsets the local variables. If You want to unset the global variable inside the function, then you have to use $GLOBALS array to do so.
What is use of PHP unset() function?
PHP unset() Function is used to destory given variable.
Syntax for unset:
unset(mixed $var, ....);
$var : Required. It specifies the variable to reset.
.... : Optional. Pass Multiple variables.
Return Values for unset :
The unset() function doesn't return any value.
Note : When you are using unset() function on inaccessible object properties, the __unset() overloading method will be called, if It is declared.
Let's see below example to understand php unset() Function in details.