PHP 4.0 Bug #2674 Updated: unset() does noet work inside function
| From: | Bug Database | Date: | Mon, 22 Nov 1999 20:40:42 +0000 |
| Subject: | PHP 4.0 Bug #2674 Updated: unset() does noet work inside function | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12939@lists.php.net to get a copy of this message | ||
ID: 2674
Updated by: zeev
Reported By: gert@wins.uva.nl
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
This is a known incompatibility with PHP 3.0, that is consistent with the way PHP 4.0 works.
In PHP 4.0, when you write 'global $foo;' you basically hint PHP
to create a reference to the global variable $foo, with the local name $foo.
When you later on call unset($foo), PHP disallocates the local reference,
and not the global variable that reference points to.
You can unset global variables by using the special $GLOBALS array:
unset($GLOBALS["foo"]);
should work.
Full Bug description available at: http://bugs.php.net/version4/?id=2674