RE: [PHP] vars

From: Date: Fri, 28 Jul 2000 12:35:41 +0000
Subject: RE: [PHP] vars
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8769@lists.php.net to get a copy of this message
I agree with this completely. You have to make the code self-documenting in some way, otherwise you are going to be spending all your time trying to figure out what the heck you did last month. Good variable names go a lot further than good comments in this direction. Since PHP is an interpreted language it is going to cost a little bit, but keep in mind that this does NOT go out to the net, which is probably your bottleneck. By the way, I LOVED that satiric example from Ed Vul. It didn't answer your question, but it did point out the extremes of bad variable names. > From: David Newcomb [mailto:davidn@vnvi.com] > > Kurth, > > In any parsed tranlated language there is a penality cost for using long > token names. Obivously $mr is going to take longer to parse than > $Monies_Received. But the tradeoff is up to you. > > There is not a huge penality, as the variables and tokens are probably > held in some kind ok hashed/indexed tree for fast access, so as > long as you pick a sensible variable character length it will not > affect you server in any noticable way. > > In generally for I use: > 1 reused character for tempory variables ($t,$i), > 3-6 characters for mainly used variables ($sum,$total) > <6 for varibles I want to keep seperate ($MYCOOKY_CUSTNO) > > Hope this gives you something to think about, > > David. > > From: Kurth Bemis <kurth@usaexpress.net> > > > from a programming standpoint is it better to use shorter var names or > > longer? longer is easier to me because i can be more descriptive....i > have > > read that shorter is easier on the server tho....thoughts? > > > > ~kurth > > Kurth Bemis - Senior Linux Network/Systems Administrator, USAExpress.net > > > > kurth@usaexpress.net > > http://www.usaexpress.net/kurth > > ICQ - 6624050 > > Call Sign - N1TYW > > PGP key available - http://www.usaexpress.net/kurth/pgp > > > > Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net > > (http://www.distributed.net) > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#8769) next »