3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a=[1=>2,2=>3]; $b=[3=>1,6=>7,1=>3]; echo ($a < $b ? "a < b\n" : ""); echo ($a > $b ? "a > b\n" : ""); echo ($a == $b ? "a == b\n" : ""); echo ($a != $b ? "a != b\n" : ""); echo ($a < $b || $a >= $b ? "" : "a <> b\n"); if (version_compare(PHP_VERSION, "7.0", ">=")) { eval('echo "a <=> b is ", ($a <=> $b), "\n";'); } $c=[2=>3,1=>1]; $d=[6=>7,1=>2]; echo ($c < $d ? "c < d\n" : ""); echo ($c > $d ? "c > d\n" : ""); echo ($c == $d ? "c == d\n" : ""); echo ($c != $d ? "c != d\n" : ""); echo ($c < $d || $c >= $d ? "" : "c <> d\n"); if (version_compare(PHP_VERSION, "7.0", ">=")) { eval('echo "c <=> d is ", ($c <=> $d), "\n";'); }
based on u38T3
Output for 7.0.0 - 7.2.0
a < b a != b a <=> b is -1 c != d c <> d c <=> d is 1
Output for 5.4.0 - 5.6.21
a < b a != b c != d c <> d
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/u8D34 on line 3
Process exited with code 255.