In this article, you will learn how to unset the variable. The unset() function in PHP unsets a variable.
what is the syntax of the UNSET() function in php?
unset(variable, ....);
Parameter | Description |
---|---|
variable | Required. Specifies the variable to unset |
… | Optional. Another variable to unset |
examples of the UNSET() function
Example 1. In this example, we unset variables.
<?php
$a = "Hello world!";
echo "The value of variable 'a' before unset: " . $a . "<br>";
unset($a);
echo "The value of variable 'a' after unset: " . $a;
?>