Re: A very strange loop!
| From: | Fredrik Thunberg | Date: | Mon, 09 Jul 2007 08:20:56 +0000 |
| Subject: | Re: A very strange loop! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258485@lists.php.net to get a copy of this message | ||
No, that won't work
Either use != 'AA'
or
for( $i = ord('A'); $i <= ord('Z'); $i++)
{
echo chr( $i ) . ' ';
}
Jason skrev:
Because you need $i<= 'Z' to get Z included as well. J At 08:49 09/07/2007, Xell Zhang wrote:-- /Thunis "Why do you need to think? Can't we just sit and go budumbudumbudum with our lips for a bit?" --The Hitchikers Guide to the GalaxyHello all, I met a very strange problem today. Take a look at the codes below: for ($i = 'A'; $i < 'Z'; $i++) { echo $i . ' '; } If you think the output is A-Z, please run it on your server and try. Who can tell me why the result is not A-Z? -- Zhang Xiao Junior engineer, Web development Ethos Tech. http://www.ethos.com.cn