PHP Alphabet Loop

Like this blog? Consider exploring one of our sponsored banner ads...

A simple way to output all the letters of the alphabet in a loop. You can use this code for making quicklinks for filtering, etc.

<?php for ($i=65; $i<=90; $i++) echo chr($i); ?>

Another cool way to do it would be to use the PHP range funtion which can take the letters of the alphabet as parameters in a loop like this:

<?php foreach(range('A','Z') as $i) echo $i; ?>

About this entry