Re: Re: Beginner Sessions Question

From: Date: Tue, 02 Jul 2002 14:08:23 +0000
Subject: Re: Re: Beginner Sessions Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-104912@lists.php.net to get a copy of this message
On Tuesday, July 2, 2002, at 03:04 AM, Richard Lynch wrote:
And, really, $result is about a generic a variable name as $i How about using $user_info or even $user_info_result? Yes, I know every example and every PHP book on the planet uses $result. That doesn't make it right :-)
I hear you -- I used to use longer names for my SQL queries -- like $user_update_sql or $filerequest_result. But once I had moved most of my code into object methods and functions (and therefore out of the global namespace/scope/whatever), I realized this really didn't matter as much. In fact, for consistency and neatness, it was better that I use only $sql or $result, since there was only ever one query in the method or function definition, and this terseness was less cluttering to my code. I completely agree if you're putting database calls into the body of a script, but if you can wrap everything into smaller scopes, it's not such a big deal. IMHO. This applies to a lot of variable names, in fact. But I agree, in the main body of the script (global scope) it is best to be descriptive. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#104912) next »