Re: questions about $_SERVER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux