Re: Letters in Loops

From: Date: Thu, 23 Mar 2006 16:00:12 +0000
Subject: Re: Letters in Loops
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232456@lists.php.net to get a copy of this message
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@dotcomholdingsofbuffalo.com

« previous php.general (#232456) next »