$test1 = (0 == "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
$test2 = (0 == "0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
var_dump($test1); //Returns False
var_dump($test2); //Returns True
We are using PHP7 and we noticed this. We got to this point because we previously tried the following:
$test3 = (0 == "0"); //Returns true
$test4 = (0 == "1"); //Returns false
$test5 = (0 == null); //Returns true
So we started playing around with the variables.
The first question is: why does $test1 return false while $test2 returns true? Does this have to do with the floating point precision? Or is it some other tweak in the php.ini that controlls the length of the string?
PD: While this doesn't affect our real use case scenario, we are thinking on forcing ourselves to always use === instead of == to avoid this behaviour.