PHP 4.0 Bug #7137 Updated: The unset function doesn't work inside a funcfion for a global var

From: Date: Wed, 11 Oct 2000 15:56:23 +0000
Subject: PHP 4.0 Bug #7137 Updated: The unset function doesn't work inside a funcfion for a global var
Groups: php.dev 
Request: Send a blank email to php-dev+get-34683@lists.php.net to get a copy of this message
ID: 7137 Updated by: stas Reported By: laszloj@psi.com Status: Closed Bug Type: Variables related Assigned To: Comments: FAQ. You cannot unset global. You should unset $GLOBALS["a"]. Please read "References Explained" in the manual, especially "Spotting References" and "Unsetting references". Previous Comments: --------------------------------------------------------------------------- [2000-10-11 11:37:13] laszloj@psi.com <? function xx() { global $a; unset($a); } // stage 1 - unset works $a=1; print "a= $a<br>"; unset($a); print "a= $a<br>"; // stage 2 - unset doesn't work in function xx $a=2; print "a= $a<br>"; xx(); print "a= $a<br>"; ?> My Result page: a= 1 a= a= 2 a= 2 - it has to be empty because of previous unset This script is working with PHP3.x --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7137

« previous php.dev (#34683) next »