note 37241 deleted from function.unset by irchtml
| From: | irchtml@php.net | Date: | Wed, 12 Jan 2005 10:42:08 +0000 |
| Subject: | note 37241 deleted from function.unset by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83132@lists.php.net to get a copy of this message | ||
Note Submitter: dh at argosign dot de
----
I recognized that it is not possible to unset a global variable in a function. The variable will be
unset only locally, after leaving the function the variable and its old contents are still
available.
$x = 10;
function test() {
global $x;
unset ($x);
echo "x: $x<br>";
}
test();
echo "x: $x<br>";
will give the result:
x:
x: 10