PHP unset() Function

❮ PHP Variable Handling Reference

Example

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;
?>
Try it Yourself »

Definition and Usage

The unset() function unsets a variable.


Syntax

unset(variable, ....);

Parameter Values

Parameter Description
variable Required. Specifies the variable to unset
... Optional. Another variable to unset

Technical Details

Return Value: None
Return Type: None
PHP Version: 4.0+

❮ PHP Variable Handling Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.