#29429 [Opn]: unset( $GLOBALS['foo']); unset only global variable, not variables that REFERED

From: Date: Thu, 29 Jul 2004 07:24:01 +0000
Subject: #29429 [Opn]: unset( $GLOBALS['foo']); unset only global variable, not variables that REFERED
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969362356@lists.php.net to get a copy of this message
ID: 29429 Updated by: tony2001@php.net Reported By: kingoleg at mail dot ru Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem Operating System: All PHP Version: 4.3.8 New Comment: It's a docu problem, not a bug. Previous Comments: ------------------------------------------------------------------------ [2004-07-28 15:05:56] kingoleg at mail dot ru Description: ------------ unset( $GLOBALS['foo']); unset only global variable, not variables that REFERED to global variable How we can unset global variable with all referenced variable using unset() function? Do we must user assign to null? Reproduce code: --------------- <?php function a( &$foo) { $foo = 'ok'; b( $foo); var_dump( $foo); } function b( &$foo) { $foo = 'not ok'; unset( $GLOBALS['foo']); } global $foo; $foo = 'global'; a($foo); var_dump( $foo); ?> Expected result: ---------------- NULL NULL Actual result: -------------- string(6) "not ok" NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29429&edit=1

« previous php.doc (#969362356) next »