"Dennis Gearon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

[snip]

> One thing I'm a little confused about is the usage of $GLOBALS array, in
> this manner:
>
>    $GLOBALS[SOME_NAME].
>
> I thought that it should be:
>
>    $GLOBALS['SOME_NAME'].
Hi,

You should use quotes to tell PHP it's a string you're using as a key of
$GLOBALS. However, when not using quotes PHP will first look for a constant
with that name. If PHP can't find any, it will assume it's a string. So not
using quotes might lead to problems when you use the name of a constant as a
key.

I hope this is clear, more info can be found at
http://www.php.net/manual/en/language.types.array.php and scroll down to
'Array do's and don'ts' -> 'Why is $foo[bar] wrong?'

HTH,

Ivo Fokkema

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

Reply via email to