RE: [PHP] IF statement madness

From: Date: Fri, 14 Mar 2003 18:36:11 +0000
Subject: RE: [PHP] IF statement madness
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139749@lists.php.net to get a copy of this message
What happens if you change $target to 216.0? -- jon -----Original Message----- From: James E Hicks III [mailto:jameshicks@noland.com] Sent: Friday, March 14, 2003 1:22 PM To: php-general@lists.php.net Subject: [PHP] IF statement madness Help save my sanity! What can I do to the IF statement in the following code to make it print the line that says "By God they are equal in value."? I have tried the following changes; 1. using === instead of == 2. placing (float) in front of the $i and $target inside and before the IF statement. <? $start = 215; $end = 217; $target = 216; for ($i=$start; $i<=$end; $i+=.1){ if ( $i == $target ){ echo ("<BR>$i - $target, By God, the are equal in value."); } else { echo ("<BR>$i - $target, Eternal Damnation, they aren't equal!"); } } ?> James E Hicks III Noland Company 2700 Warwick Blvd Newport News, VA 23607 757-928-9000 ext 435 jameshicks@noland.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#139749) next »