Re: A very strange loop!

From: Date: Mon, 09 Jul 2007 08:51:39 +0000
Subject: Re: A very strange loop!
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-258490@lists.php.net to get a copy of this message
OK. I did test like this: $a = 'Z'; $b = $a; $b++; print 'b = a<br />'; print 'b++<br />'; if ($a > $b) print 'a > b<br />'; The output is funny:) Thanks all of you! I think clive's way is the best for me:) On 7/9/07, Chris <dmagick@gmail.com> wrote:
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? Try foreach (range('a', 'z') as $letter) { echo $letter . "<br/>\n"; } -- Postgresql & php tutorials http://www.designmagick.com/
-- Zhang Xiao Junior engineer, Web development Ethos Tech. http://www.ethos.com.cn

« previous php.general (#258490) next »