I was trying something and I ran into this problem:
<?php
echo 100 - 99.9;
// gives: 0.099999999999994
can anyone tell me why this happened and how can I fix this?
I was trying something and I ran into this problem:
<?php
echo 100 - 99.9;
// gives: 0.099999999999994
can anyone tell me why this happened and how can I fix this?
The reason for this is it's floating point number read why this happens here https://floating-point-gui.de/ more info is also avalible here https://www.php.net/manual/en/language.types.float.php TLDR: Floating point numbers have small difrenses at the end.