[GRLUG] What's Z + 1

Justin Denick justin.denick at gmail.com
Wed Oct 31 15:15:24 EDT 2007


Depends on what you're counting with.

I needed to loop over [A-Z] to make some anchors and stumbled across
something interesting.

for ($i="A"; $i < Z; $i++):
  echo($i);
endfor;

Gives ABCD{..}XY

for ($i="A"; $i <= Z; $i++):
  echo($i);
endfor;

Gives ABCD{..}XYZAABB{..}

So I'm using
for ($i="A"; ($i <= Z and $i != "AA"); $i++):
  echo($i);
endfor;

This produces the desired results.

>From what I understand the default php behavior matched perl in that Z++ =
"AA" not "]" as it would in C (so I 've read)

Is there a better way to do this?

-- 
In vino veritas.
        [In wine there is truth.]
                -- Pliny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shinobu.grlug.org/pipermail/grlug/attachments/20071031/19b4deff/attachment-0001.htm 


More information about the grlug mailing list