|
Posted by Oliver Grätz on 02/14/07 23:58
Toby A Inkster schrieb:
>
> What most other languages refer to as "globals" PHP calls "superglobals".
> There's no way to define superglobals though -- PHP defines a few on its
> own (depends on your version, but in recent ones, $_POST, $_GET, $SERVER,
> $_SESSIOM, $_ENV, $_FILES and $GLOBALS) and you're stuck with them.
>
> Although I steer away from globals (in my current project, over 4000 lines
> of PHP so far, and not a single global!), sometimes I really would
> appreciate having a method of defining superglobals. Not going to happen
> though. :-(
I intentionally left out elaborating about the nature of the globals vs
superglobals because use of global variables is somewaht discouraged.
Even Zend tells developers to use static class variables instead. And by
the way, Defining your own superglobals is NOT impossible. You CAN use
the runkit extension (http://de.php.net/runkit) to define variables as
superglobals. But the nature of this extension as "sandbox" should tell
developers not to do so ;-) But if you find _good_ reasons to use your
own superglobals, you are free to do so.
OLLi
Navigation:
[Reply to this message]
|