PHP 5 per-class constants can already except static arrays such as array(1, 2, 3) as their value. I'll put the issue of global constants on my TODO and believe PHP 5 will also support these for global constants. However, you won't be able to create a constant with a non-constant value such as $_GET as this goes against the whole idea of constant :)
Andi On Thu, 24 Jan 2002, Robert Ames wrote: > Thanks for your responses (again), it is an unfortunate situation that > $HTTP_*_VARS must be retained for backwards compatibility until at least > the hypothetical PHPv5.0 mark. Having also read in this group that > define() does not support complicated constants, I'm guessing that it's > not currently possible to force all predefined variables to be read only > (although that seems like the best solution in the long run). > > Regarding the documenation- it is not clear, and is not emphasized that > the arrays are disjoint. > > """Note: Some of these arrays had old names, e.g. $HTTP_GET_VARS. These > names still work, but we encourage users to switch to the new shorter, > and auto-global versions.""" > > > """ > $HTTP_GET_VARS > An associative array of variables passed to the current script via the > HTTP GET method. > > $_GET > An associative array of variables passed to the current script via the > HTTP GET method. Automatically global in any scope. Introduced in PHP > 4.1.0. > """ > > ...this will be the last message I'll bother the lists with about this > behaviour. I just wanted to make sure that you guys who are developing > this stuff receive feedback about how this new behaviour is working out > for people using the new versions of PHP. :^) > > I'm 100% in favor of treating these arrays as read-only, but it would be > very nice if E_NOTICE's were thrown when builtin arrays are modified, or > simply to treat them as unchangeable constants. Something to keep in > mind if we ever get the ability to say: > > define( '_GET', $_GET ); > > ...which is interesting in itself... imagine: > > echo _GET['blah']; > > ...instead of: > > echo $_GET['blah']; > > ...since _GET/etc... are already auto-globals, and you don't want them to > be used as left-hand-side values, it seems like they're very close to > acting like constants already. Just a thought. ;^) > > Thanks a bunch! > > --Robert > > On Thu, 24 Jan 2002 16:01:24 -0600, Lars Torben Wilson wrote: > > On Thu, 2002-01-24 at 13:42, Rasmus Lerdorf wrote: > >> I think the real answer here is to treat these as read-only arrays. ie. > >> never use them on the left side of the '=' and you will never run into > >> problems. Or if you do, be consistent and use the same array all the > >> time. You are writing your code with the assumption that these two > >> arrays are the same. Where does this assumption come from? Hopefully > >> not the documentation. > >> > >> -Rasmus > > > > No, they are properly--if lightly--documented on the following pages: > > > > http://www.php.net/manual/en/language.variables.predefined.php > > http://www.php.net/release_4_1_0.php > > > > Robert, the $HTTP_*_VARS have, indeed, been deprecated, and this is > > noted in the manual. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]