PHP unset() Function
PHP unset() Function
The unset() function in PHP is used to unset a given variable. This function destroys the specified variables.
If this function is called inside any user-defined function, then it unsets the value associated with the variables inside it and leaves the value which is initialized outside it.
Syntax
unset ( mixed $var [, mixed $... ] )
Parameter
var(required)- This parameter represents the variable to unset.
Return
NA
Example 1
Output
Before the unset() function: Hello World After the unset() function:
Example 2
Output
The variable: TutorialAndExamples After the unset() function... The variable: TutorialAndExamples
Example 3
Output
The variable: TutorialAndExamples After the unset() function... The variable: