Re: Letters in Loops

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

 



phpninja wrote:
Hello,


for($i=A;$i<=Z;$i++) {

if ($i == "ZZ") { break; }

echo "$i";

}
regards,
phpninja

While this may work (I didn't test it), it's a hack and might produce unexpected results (assuming you meant to quote the strings). PHP will, "Translate strings and resources to numbers, usual math" to compare them. It would be better to set the range you want, and loop thru that.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx

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