I'm in the process of simultaneously templatizing my site and converting all dates I store everywhere to GMT/UTC, which of course impacts on how I have to display dates and times, among other things. So, things are a little funky right now.
Everyone knows the standard for loop idiom:
for($n=0; $n<@arr; $n++) #...
It turns out there are a few more idioms that people use. First, usually you want to cache the upper bound to avoid having to calculate it every time. That's not as important for a language like Perl or PHP where scalar(@arr) or count($arr) or strlen($str) is a quick operation, but it's very important for something like strlen(str) in C:
for(int n=0,int c=strlen(str); n<c; n++) //...
Another one is the following, which works nicely if you want to count backwards:
for($n=@arr-1; $n--;) #...
new⇒Trogdor tattoo!!
Oh, so cute, wowoowow....
Kathy Mead: Sep 7, 6:07am