[thelist] PHP Looping

Ben Phillips ben at inchima.com
Fri May 31 09:15:01 CDT 2002


> Does anyone have any php code that will allow you to loop
> from A to Z?  For some reason, I cannot think how this can be
> done.  I know is cold fusion I could just use the cfloop tag,
> but I can't picture it in PHP.

stick a,b,c,d....z into an array and loop through it:

$alphabet = array('a', 'b', 'c', ... 'z');

foreach ($alphabet as $letter) {
  // do whatever to $letter...
}

nb: foreach is php 4 only.

benji
inchima.com





More information about the thelist mailing list