3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($firstValue, $secondValue) { if ($firstValue > $secondValue) { return 1; } if ($firstValue < $secondValue) { return -1; } return 0; } $array = array('a', 'b', 'a', 'b', 'c'); usort($array, 'test'); echo print_r($array);

preferences:
45.25 ms | 402 KiB | 5 Q