3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on tFW27
Output for 4.3.0 - 5.6.38, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.3.1
Array ( [0] => a [1] => a [2] => b [3] => b [4] => c ) 1