I'm not too much of an expert in Maths but when we try to equate 19.95 / 2.85
in any calculator we get the output as 7.
Trying the same arithmetic equation in PHP:
$val = 19.95 / 2.85;
echo $val; // 7
echo floor($val); // 6
Trying the same arithmetic equation in JavaScript:
var val = 19.95 / 2.85;
console.log(val); // 6.999999999999999
console.log(Math.floor(val)); // 6
How can I make sure that when i use floor()
in PHP that the output I get from the above arithmetic equation equals 7?