Re: Opinion about the using $GLOBALS directly
| From: | Jochem Maas | Date: | Wed, 19 Dec 2007 12:52:26 +0000 |
| Subject: | Re: Opinion about the using $GLOBALS directly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266068@lists.php.net to get a copy of this message | ||
Sancar Saran schreef:
> Hello list.
>
> I want know to you opinions about using $GLOBALS directly.
>
> like
>
> $GLOBALS['myString'] = 'test';
> $GLOBALS['myArray']['this'] = 'this';
> $GLOBALS['myArray']['that'] = 'that';
> $GLOBALS['myClassObj] = new SomeClass;
there is no real difference between 'global $foo' and $GLOBALS['foo'],
and the second is probably more maintainance friendly (as Rob pionted out)
that said, avoid globals like the plague - sometimes you may come up with
a situation where using a global is really necessary - such situations should
be the exception rather than the rule, often if your thinking of using a
global there is another way of doing it. jmho
>
> Regards
>
> Sancar
>