3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ar = ['a', 'b', 'a', 'c']; uasort($ar, function($a, $b){ if ($a > $b) { return 1; } if ($a < $b) { return -1; } return 0; }); print_r($ar); echo PHP_EOL; uasort($ar, function($a, $b){ return strcasecmp($a, $b); }); print_r($ar); echo PHP_EOL; uasort($ar, function($a, $b){ return strcmp($a, $b); }); print_r($ar);
Output for 5.6.38
Array ( [0] => a [2] => a [1] => b [3] => c ) Array ( [0] => a [2] => a [1] => b [3] => c ) Array ( [0] => a [2] => a [1] => b [3] => c )