Advertisement
Guest User

PHP comparsion fails with floats in 5.3.15 & 5.3.16

a guest
Mar 6th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. $total = '229.5';
  2. $t = floatval($total) * floatval('0.20');
  3. $taxed = $total - $t;
  4.  
  5. if ($taxed < 99) {
  6.        print 1;
  7.        $admin = $taxed - 10;
  8.        $charge = 10;
  9. } elseif (($taxed >= 99) && ($total < 199)) {
  10.        $admin = $taxed - 15;
  11.        $charge = 15;
  12.        print 2;
  13. } elseif ($taxed >= 199) {
  14.        $admin = $taxed - 20;
  15.        $charge = 20;
  16.        print 3;
  17. } else {
  18.        print "Error";
  19. }
  20.  
  21.  
  22. print $admin;
  23. print "<br />";
  24. print $charge;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement