3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "Compare two non numeric strings: ('str' == '0') = " . ('str' == '0' ? 'true' : 'false'); echo "Compare non numeric string to intteger 0: ('str' == 0) = " . ('str' == 0 ? 'true' : 'false'); echo "Compare two numeric strings (same senamtic): ('1e1' == '10') = " . ('1e1' == '10' ? 'true' : 'false'); echo "Compare two numeric strings (precision): ('0.9999999999999999' == '1') = " . ('0.9999999999999999' == '1' ? ' true' : 'false'); echo "Compare two numeric strings (precision1): ('0.99999999999999991' == '1') = " . ('0.99999999999999991' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision2): ('0.99999999999999992' == '1') = " . ('0.99999999999999992' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision3): ('0.99999999999999993' == '1') = " . ('0.99999999999999993' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision4): ('0.99999999999999994' == '1') = " . ('0.99999999999999994' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision5): ('0.99999999999999995' == '1') = " . ('0.99999999999999995' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision6): ('0.99999999999999996' == '1') = " . ('0.99999999999999996' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision7): ('0.99999999999999997' == '1') = " . ('0.99999999999999997' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision8): ('0.99999999999999998' == '1') = " . ('0.99999999999999998' == '1' ? 'true' : 'false'); echo "Compare two numeric strings (precision9): ('0.99999999999999999' == '1') = " . ('0.99999999999999999' == '1' ? 'true' : 'false');
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Compare two non numeric strings: ('str' == '0') = falseCompare non numeric string to intteger 0: ('str' == 0) = trueCompare two numeric strings (same senamtic): ('1e1' == '10') = trueCompare two numeric strings (precision): ('0.9999999999999999' == '1') = falseCompare two numeric strings (precision1): ('0.99999999999999991' == '1') = falseCompare two numeric strings (precision2): ('0.99999999999999992' == '1') = falseCompare two numeric strings (precision3): ('0.99999999999999993' == '1') = falseCompare two numeric strings (precision4): ('0.99999999999999994' == '1') = falseCompare two numeric strings (precision5): ('0.99999999999999995' == '1') = trueCompare two numeric strings (precision6): ('0.99999999999999996' == '1') = trueCompare two numeric strings (precision7): ('0.99999999999999997' == '1') = trueCompare two numeric strings (precision8): ('0.99999999999999998' == '1') = trueCompare two numeric strings (precision9): ('0.99999999999999999' == '1') = true