<?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);
You have javascript disabled. You will not be able to edit any code.