note 37241 added to function.unset
| From: | dh at argosign dot de | Date: | Fri, 07 Nov 2003 10:41:24 +0000 |
| Subject: | note 37241 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60068@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37241
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37241&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37241&report=yes
Search -- http://master.php.net/manage/user-notes.php