Re: Why can constants only be scalars?
| From: | Ilya Sher | Date: | Thu, 13 May 2004 22:10:20 +0000 |
| Subject: | Re: Why can constants only be scalars? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9852@lists.php.net to get a copy of this message | ||
Sean Coates wrote:
Ilya Sher wrote:That is one more word (to type) to access the variable, each time. If you acces a variable more than once in the function you would probably like to declare it global (the usual way). Or even extact($GLOBALS['my_globs']); which would be a hash of all globals one usually needs. I don't see much of advantage here. The most frustrating case would be one usage of a global per function. "superglobals" would save a lot of typing. The suggested method wouldn't. This discussion is theoretical anyway because Andi already said "no" ...We discussed this issue with Jevon Wright (private emails) and in the end of the day agreed that most simple yet powerful solution is "superglobals", which would work like $_GET,$_POST etc.This can be accomplished in user-space, by cheating the existing $_* superglobals (if you must -- cowiki does this, IIRC): <?php $_SERVER['foo'] = array('bar', 'baz'); function oink() { print_r($_SERVER['foo']); } oink(); ?> S