Re: questions about $_SERVER
| From: | Stuart Dallas | Date: | Tue, 13 Mar 2012 16:20:23 +0000 |
| Subject: | Re: questions about $_SERVER | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317008@lists.php.net to get a copy of this message | ||
On 13 Mar 2012, at 15:59, Tedd Sperling wrote:
> In any event, I seldom use globals anyway. This was more an academic discussion.
If you're being academic about it please remember that the way PHP defines globals is different
to most other languages.
PHP: A variable defined at the top-level scope.
World: A variable that is visible at every scope.
This is an important difference if you ever move from PHP to another language. It ultimately also
means that only the superglobals are true globals.
The $GLOBALS superglobal contains all variables defined at the top-level scope, including $GLOBALS,
so $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['_SERVER'] is a
perfectly valid, if daft, way of accessing $_SERVER.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/