3v4l.org

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