Re: [PHP] Opinion about the using $GLOBALS directly
- From: sancar.saran@xxxxxxxxxx (Sancar Saran)
- Date: Wed, 19 Dec 2007 16:18:07 +0200
Hello Jochem,
Thanks for response, I'm using this aproach maybe more than one year. I did
not get any problems.
there is no real difference between 'global $foo' and $GLOBALS['foo'],
and the second is probably more maintainance friendly (as Rob pionted out)
Yes you are right writing global $foo in 25+ functions a bit problematic.
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
And this is why I'm asking here, WHY I should avoid globals like plague ?
Every one says bad. Alright, but no one says WHY ?
I try to use alternative ways. But maintenance, complexty and speed costs much
too high.
I did not see any benefit.
Robert Cummings says to "you may confusing to setting variable". I have some
debugging methots to detect this.
And Of course I did not use someting like for($GLOBALS['i']=0;....
And I use GLOBALS for everything for I need someting more than once. (Db
pointer or config array etc).
Thanks for response
Regards
Sancar
.
- Follow-Ups:
- Re: [PHP] Opinion about the using $GLOBALS directly
- From: tedd
- Re: [PHP] Opinion about the using $GLOBALS directly
- From: "Richard Lynch"
- Re: Opinion about the using $GLOBALS directly
- From: Colin Guthrie
- Re: [PHP] Opinion about the using $GLOBALS directly
- References:
- Opinion about the using $GLOBALS directly
- From: Sancar Saran
- Re: [PHP] Opinion about the using $GLOBALS directly
- From: Jochem Maas
- Opinion about the using $GLOBALS directly
- Prev by Date: Re: [PHP] Opinion about the using $GLOBALS directly
- Next by Date: Re: [PHP] PHP and VB.NET communication
- Previous by thread: Re: [PHP] Opinion about the using $GLOBALS directly
- Next by thread: Re: Opinion about the using $GLOBALS directly
- Index(es):
Relevant Pages
|