Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only

From: Date: Fri, 10 Dec 2010 00:25:32 +0000
Subject: Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-50985@lists.php.net to get a copy of this message
2010/12/9 Ángel González <keisial@gmail.com>: >> Not to mention, I have had issues (and I can't reproduce it properly >> or I would report it) where sometimes i will have a variable in global >> scope in one file, and I have to reference it as $GLOBALS['variable'] >> in another include, or I have to global $variable; in the include to >> be able to get to it, and I'm not quite sure why. > Is that second file included inside a function? No, that would make some sense. This is a loose example, and like I said it's not consistent, and I can't figure out good ways to model why I run into this once in a while. fileA.php: $foo = 'bar'; require fileB.php; fileB.php: echo $foo; <- doesn't work echo $GLOBALS['foo']; <- works global $foo; echo $foo; <- works

« previous php.internals (#50985) next »