Advertise here with Carbon Ads

This site is made possible by member support. โค๏ธ

Big thanks to Arcustech for hosting the site and offering amazing tech support.

When you buy through links on, I may earn an affiliate commission. Thanks for supporting the site! home of fine hypertext products since 1998.

๐Ÿ”  ๐Ÿ’€  ๐Ÿ“ธ  ๐Ÿ˜ญ  ๐Ÿ•ณ๏ธ  ๐Ÿค   ๐ŸŽฌ  ๐Ÿฅ”

Programming’s two worst variable names

Programming’s two worst variable names. $data and $data2

Reader comments

rheiserMar 09, 2004 at 10:15AM

I don't know. I was just working with some code where the engineer had declared two variables that worked together and named them "l0" and "l1". When I saw an assignment akin to; "l0 = l1 + 1" , I had to do a double take. It looks a lot more like "10" and "11" in the monospaced font my IDE was using.

JimMar 09, 2004 at 12:56PM

Heh, I've run into that when coding in Courier New. I've been trying out some alternatives.

I'd have to disagree with Mr. Lester though. The worst variable names are those that are unintentionally misleading. Uninformative is irritating, but misleading can be disastrous.

The article reminds me of this classic.

JosephMar 09, 2004 at 9:22PM

My least favourite variable name, which I will admit to having used once or twice, is $l. Because at this point, when you're debugging six months later, you've just hit the fourth loop control counter (after $i, $j, and $k, by convention) in a deep dark nest, and you'd dearly love just a little bit more information please.

barlowMar 10, 2004 at 1:38PM

Is there much of a performance hit using long variable names in an interpreted language like PHP? I tend to use extremely long, descriptive variable names in lieu of commenting my code and I just haven't known how to look into the question of performance. Any insights would be appreciated.

samMar 12, 2004 at 9:06AM

I don't know anything about PHP internals but I should certainly think the answer is 'no'; most likely definied variables will be stored in some kind of hash so it can find them without having to search through the whole string. Even if they're not, who cares? Comparing two strings costs essentially nothing on modern processors, compared to your code that actually *does* something (like accesses a database or whatever).

Frankly in most PHP code you probably shouldn't care about performance anyway. Does your code run too slowly? If not, then why are you worrying? :) Premature optimisation is usually described as a major sin... I mean if you really need it to like run on some kind of embedded system or whatever where CPU cycles, RAM etc. are at a serious premium, then you shouldn't be using PHP in the first place.

so anyway - I'd go with your nice long variables, definitely. (But long variables are not a replacement for comments. Do both! Ensure your place in heaven. :)

This thread is closed to new comments. Thanks to everyone who responded.