NYCPHP Meetup

NYPHP.org

[nycphp-talk] Length of variable names

Andy Dirnberger dirn at dirnonline.com
Tue Jul 3 14:13:18 EDT 2007


Ken,

Thanks.  Looks like a lot of us just learned something new today.

DiRN

> -----Original Message-----
> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On
> Behalf Of Ken Robinson
> Sent: Tuesday, July 03, 2007 1:13 PM
> To: talk at lists.nyphp.org
> Subject: RE: [nycphp-talk] Length of variable names
> 
> Quoting Andy Dirnberger <dirn at dirnonline.com>:
> 
> > As far as i goes, I've always assumed it was just shorthand for
something
> > like index or increment.  Nested for loops are often then controlled
with j
> > and then k.  You can use these with confidence that people will
understand
> > the meaning.  But if you feel more comfortable using a variable called
> > $counter than one called $i, by all means do so.  There are plenty of
people
> > out there who refuse to use i.
> 
> The use of variable names like $i, $j, $k, etc for counters is a hold
> over from early Fortran which declared that only variables starting
> with certain letters could be integers. The first letter was "i". I
> seem to remember that only the letters i, j, l, l, m, n were used for
> integer variables, so the use quickly became a "standard" and it's
> been carried over into other languages through the use of examples
> written by old time programmers.
> 
> Ken
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
> 
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list