NYCPHP Meetup

NYPHP.org

[nycphp-talk] Length of variable names

tedd tedd at sperling.com
Tue Jul 3 19:17:26 EDT 2007


At 1:13 PM -0400 7/3/07, Ken Robinson wrote:
>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

Hey, let's watch those "old programmer" remarks, because some of us 
are still around. But, you are right about the i, j, k, l, m, n 
integer thing as a legacy from FORTRAN. Oh, those were the good old 
days when programming was more like adventures in key punching. Where 
you would drop off a large stack of IBM cards one day and then pick 
up a few reams of paper the next day with all your key punching 
errors.

Cheers,

tedd

-- 
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com



More information about the talk mailing list