Mega Code Archive

 
Categories / Php / Data Type
 

Comparing float values

<? $cost = 1.22; $limit = 1.00; function check_limit($total_cost, $credit_limit) {      if ($total_cost > $credit_limit) :           return 0;      endif;      return 1; } if (check_limit($cost, $limit)):     print "OK"; else :     print "Balance less than $".$limit."!"; endif; ?>