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

From: Date: Wed, 11 Oct 2000 15:51:52 +0000
Subject: Re: PHP 4.0 Bug #7137: The unset function doesn't work inside a funcfion for a global var
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-34678@lists.php.net to get a copy of this message
Hiya this is the intended behavior To unset a global var use unset($GLOBALS[var]); Please close you bug Greetz, Wico At 15:37 11-10-00 +0000, laszloj@psi.com wrote:
From:             laszloj@psi.com
Operating system:
PHP version:      4.0.2
PHP Bug Type:     Variables related
Bug description:  The unset function doesn't work inside a funcfion for a global var
<? 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 -- Edit Bug report at: http://bugs.php.net/?id=7137&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.dev (#34678) next »