I have a problem with an if
statement. The program doesn't go inside the if
when it seems that the condition is true.
I tried to change the operator >=
to ==
but it still doesn't work. It works with <=
but I need >=
and I also can't explain to myself why it's not working.
<?php
$balance = 0.03; // input 0.03
if($balance >= 0.02)
{
$returned = ((floor($balance / 0.02)) * 0.02); // 0.02
$balance = $balance - $returned; // 0.03 - 0.02 = 0.01 left
}
echo var_dump($balance) . PHP_EOL;
if($balance >= 0.01) // why doesnt go in ?
{
echo "Print Smt ....";
}
Why is the second if
not true? Isn't 0.01 equal to 0.01?