I have a math problem with PHP and I don't understand why this happens.
I use the following construct, and it worked well but I found a bug and don't know how to fix it.
$value1 = 0.07;
$value2 = 0.7;
$difference = $value2 - ($value1 * 10);
echo $difference;
If you use random values like $value1 = 0.5 and $value2 = 13, it works like it should. In this case, 0.7 - (0.07 * 10) = -1.11022302463E-16 and I don't understand why. If you use other values like $value1 = 0.5 and $value2 = 5, there's no problem even if the result should be 0 too.
Hopefully, somebody might know where's the problem and how to fix it.
best regards