Re: Opinion about the using $GLOBALS directly

From: Date: Fri, 21 Dec 2007 16:23:59 +0000
Subject: Re: Opinion about the using $GLOBALS directly
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-266207@lists.php.net to get a copy of this message
Richard Lynch wrote:
On Wed, December 19, 2007 11:22 am, Stut wrote:
well, if you have a long and complex function declaration which begins with global $whatever, and then all over the function $whatever is used, some dozens of lines later when looking for something in the code you might not have any idea that $whatever is global... however if you used $GLOBALS['whatever'] everywhere it would be trivial.
Indeed.
I don't really care how long the function is. $connection is a global in the scripts. It's the only global there is. It's a global in any function that needs it. If I can't remember that from day to day, then I need to find a nurse to take care of me... [shrug]
I feel sorry for anyone that ever inherits your code. You're making their life needlessly more difficult. I've inherited enough code in my time to appreciate the extra effort to create readable and maintainable code. -Stut -- http://stut.net/

« previous php.general (#266207) next »