Re: Opinion about the using $GLOBALS directly
| From: | Richard Lynch | Date: | Wed, 19 Dec 2007 16:04:03 +0000 |
| Subject: | Re: Opinion about the using $GLOBALS directly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266092@lists.php.net to get a copy of this message | ||
On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
> 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;
Don't.
You are using global variables, and you might as well admit it and use
the 'global' keyword to designate them as such.
Poking stuff into $GLOBALS instead just makes it look like you're
trying to pretend you're not using global variables when you are, to
me.
I did form this opinion before altering $GLOBALS was a documented
feature.
ymmv
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?