3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $a = array(3, 2, 5, 6, 1); usort($a, "cmp"); var_dump($a);
based on CpIlp
Output for 4.3.0 - 7.1.7
array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(5) [4]=> int(6) }