Re: Opinion about the using $GLOBALS directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux