[GRLUG] What's Z + 1
Jeff DeFouw
jeffd at i2k.com
Wed Oct 31 20:31:05 EDT 2007
On Wed, Oct 31, 2007 at 03:15:24PM -0400, Justin Denick wrote:
> So I'm using
> for ($i="A"; ($i <= Z and $i != "AA"); $i++):
> echo($i);
> endfor;
>
> This produces the desired results.
>
> Is there a better way to do this?
Probably
foreach (range('A','Z') as $i):
echo($i);
endforeach;
since php 4.1. At least it looks simpler. I don't know if it's
internally better.
--
Jeff DeFouw <jeffd at i2k.com>
More information about the grlug
mailing list