3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ar = ['a', 'b', 'a', 'c', '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 ( [4] => A [6] => A [5] => B [7] => C [0] => a [2] => a [1] => b [3] => c ) Array ( [2] => a [0] => a [4] => A [6] => A [1] => b [5] => B [3] => c [7] => C ) Array ( [4] => A [6] => A [5] => B [7] => C [2] => a [0] => a [1] => b [3] => c )