I want to compare two floats in PHP, like in this sample code:
$a = 0.17; $b = 1 - 0.83; //0.17 if($a == $b ){ echo \'a and b are same\'; } else { echo \'a
Here is the solution for comparing floating points or decimal numbers
//$fd['someVal'] = 2.9; //$i for loop variable steps 0.1 if((string)$fd['someVal']== (string)$i) { //Equal }
Cast a decimal variable to string and you will be fine.
decimal
string