3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $hasspaceship = @eval("return 1 <=> 2;"); $a=[1=>1,2=>3]; $b=[1=>2,6=>7]; 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 ($hasspaceship) { 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 ($hasspaceship) { eval('echo "c <=> d is ", ($c <=> $d), "\n";'); }
Output for hhvm-3.10.1 - 3.17.3, 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.5.0 - 5.6.30
a < b a != b c != d c <> d