3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "Compare two non numeric strings: ('str' == '0') = " . ('str' == '0' ? 'true' : 'false') . "\n"; echo "Compare non numeric string to intteger 0: ('str' == 0) = " . ('str' == 0 ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 1): ('1e1' == '10') = " . ('1e1' == '10' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 1): ('1e-1' == '10') = " . ('1e-1' == '10' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 1): ('1E1' == '10') = " . ('1E1' == '10' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 1): ('1E-1' == '10') = " . ('1E-1' == '10' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 2): ('+1' == '1') = " . ('+1' == '1' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (same senamtic 3): ('+0' == '-0') = " . ('+0' == '-0' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (precision 1): ('0.99999999999999994' == '1') = " . ('0.99999999999999994' == '1' ? 'true' : 'false') . "\n"; echo "Compare two numeric strings (precision 2): ('0.99999999999999995' == '1') = " . ('0.99999999999999995' == '1' ? 'true' : 'false') . "\n";
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') = false Compare non numeric string to intteger 0: ('str' == 0) = true Compare two numeric strings (same senamtic 1): ('1e1' == '10') = true Compare two numeric strings (same senamtic 1): ('1e-1' == '10') = false Compare two numeric strings (same senamtic 1): ('1E1' == '10') = true Compare two numeric strings (same senamtic 1): ('1E-1' == '10') = false Compare two numeric strings (same senamtic 2): ('+1' == '1') = true Compare two numeric strings (same senamtic 3): ('+0' == '-0') = true Compare two numeric strings (precision 1): ('0.99999999999999994' == '1') = false Compare two numeric strings (precision 2): ('0.99999999999999995' == '1') = true