IF statement madness
| From: | James E Hicks III | Date: | Fri, 14 Mar 2003 18:21:31 +0000 |
| Subject: | IF statement madness | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-139746@lists.php.net to get a copy of this message | ||
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