Re: Looping through the alphabet [was: Why does it work this way?]
| From: | Steve Werby | Date: | Mon, 02 Apr 2001 17:06:50 +0000 |
| Subject: | Re: Looping through the alphabet [was: Why does it work this way?] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46650@lists.php.net to get a copy of this message | ||
"Boget, Chris" <Chris.Boget@wild.net> wrote:
> for( $i = "a"; $i <= "z"; $i++ ) {
> }
>
> Not entirely too sure why, but the above works. And
> it's really cool that it does. :)
> However, it doesn't work as one would expect (aside
You may know this already and not have a need, but for the benefit of others
who may have read your post, you can loop through 'a' to 'z' using the chr()
function as follows:
<?php
for ( $i = 97; $i <= 122; $i++ )
{
echo chr( $i );
}
?>
--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/