Re: A very strange loop!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
Hello 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


--
/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 Galaxy

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux