|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-29 09:23 UTC] tony2001@php.net
[2004-07-29 09:44 UTC] kingoleg at mail dot ru
[2004-07-29 09:51 UTC] tony2001@php.net
[2004-07-29 10:04 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Feb 12 09:00:01 2026 UTC |
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