Return to Snippet

Revision: 48913
at July 12, 2011 22:39 by plesh


Initial Code
// Loop through ASCII characters until reaching 90
for ($i=65; $i<=90; $i++) {  
     
    // store the character
    $letter = chr($i);
 
    // build alphabetical link
    $alphabet .= '<a title="filter results by letter '.$letter.'" href="/business/'.$letter.'"> ';
    $alphabet .= $letter;
    $alphabet .= '</a> | '; 
}
 
// print links
echo $alphabet;

Initial URL
http://www.apashley.co.uk/snippets/38/Loop-Through-The-Alphabet-With-Php.html

Initial Description
Loops through ASCII characters to display alphabet, useful for alphabetic filtering links.

eg: A | B | C | D ...

Initial Title
Loop through Alphabet with PHP

Initial Tags
php

Initial Language
PHP