RE: [PHP] Confused - $GLOBALS
| From: | Richard Lynch | Date: | Fri, 10 Dec 2004 21:01:44 +0000 |
| Subject: | RE: [PHP] Confused - $GLOBALS | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203965@lists.php.net to get a copy of this message | ||
>> I always forget, because they changed it around on POST/GLOBALS/etc at
>> some point, but only on some of them. Grrr.
>
> The built-in arrays with names beginning $_ are "superglobals", i.e.
> always
> global anyway. The only other "superglobal" is $GLOBALS, which is a
> anming
> exception because it existed long before the $_ arrays came into
> existence.
> This has not changed at any point in the life of PHP -- the only change
> was
> the actual introduction of the $_ versions.
Allow me to be more precise.
In version 4.1.0 of December 2001's change log, we find this entry:
"Introduced $_GET, $_POST, $_COOKIE, $_SERVER and $_ENV variables, which
deprecate the old $HTTP_*_VARS arrays. In addition to be much shorter to
type - these variables are also available regardless of the scope, and
there's no need to import them using the 'global' statement. (Andi &
Zeev)"
Therefore my prepetual confusion about which thingies are superglobals
comes from the old $HTTP_*_VARS arrays, which are not superglobals, and
their $_* vars which have the same data, but are superglobals, and the
$GLOBALS variable, which has always been a superglobal.
So when I was supposed to go convert all my $HTTP_*_VARS, I *also* had to
get rid of all the places I used to have to make them global, but now I
don't any more... Woof. Can't just global search and replace my source
code, can I?
Now I know why I'm making that change piece-meal. :-^
--
Like Music?
http://l-i-e.com/artists.htm