note 114669 added to function.unset

From: Date: Thu, 20 Mar 2014 08:10:11 +0000
Subject: note 114669 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-198987@lists.php.net to get a copy of this message
You can unset superglobals like $GLOBALS, $_GET etc., but causing an unususal behavior (as of PHP 5.3.3). 1) unsetting of superglobals is done globally, i.e. unsetting inside the function affects GLOBALLY. 2) Recreation of unset'ed superglobals can be done (recreated valiables are superglobals), but original functionality (in $GLOBALS, $_SESSION ...) has lost. <?php function foo(){ unset($GLOBALS); } function bar(){ var_dump($GLOBALS); } foo(); bar(); //issues E_NOTICE ($GLOBALS not defined) $GLOBALS=3; bar(); //displays int(3) ?> ---- Server IP: 72.52.91.14 Probable Submitter: 183.177.153.216 ---- Manual Page -- http://php.net/manual/en/function.unset.php Edit -- https://master.php.net/note/edit/114669 Del: integrated -- https://master.php.net/note/delete/114669/integrated Del: useless -- https://master.php.net/note/delete/114669/useless Del: bad code -- https://master.php.net/note/delete/114669/bad+code Del: spam -- https://master.php.net/note/delete/114669/spam Del: non-english -- https://master.php.net/note/delete/114669/non-english Del: in docs -- https://master.php.net/note/delete/114669/in+docs Del: other reasons-- https://master.php.net/note/delete/114669 Reject -- https://master.php.net/note/reject/114669 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198987) next »