note 71896 added to language.variables.scope
| From: | testatthecodingtreepuntocom at osu1 dot php dot net | Date: | Thu, 21 Dec 2006 14:18:25 +0000 |
| Subject: | note 71896 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120827@lists.php.net to get a copy of this message | ||
I found, at least in PHP 5.1.1 (IIS v6) that the superglobal $GLOBAL is not so super if it is
definded within a function or class.
example:
<?PHP
function test(){
$GLOBAL['test'] = 'hello';
}
test();
echo $GLOBAL['test'];
?>
Output:
Notice: Undefined variable: GLOBAL in c:\XXXXXXX\XXXXXX\test\index.php on line 9
This may be obvious to some but I though when they said it was global it would be just that, global,
no matter what scope it was call in. This may be an issue only in IIS but still is troublesome.
----
Server IP: 66.163.161.117
Probable Submitter: 68.231.230.137
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/71896
Del: integrated -- https://master.php.net/note/delete/71896/integrated
Del: useless -- https://master.php.net/note/delete/71896/useless
Del: bad code -- https://master.php.net/note/delete/71896/bad+code
Del: spam -- https://master.php.net/note/delete/71896/spam
Del: non-english -- https://master.php.net/note/delete/71896/non-english
Del: in docs -- https://master.php.net/note/delete/71896/in+docs
Del: other reasons-- https://master.php.net/note/delete/71896
Reject -- https://master.php.net/note/reject/71896
Search -- https://master.php.net/manage/user-notes.php