int LastElementIndex = arr.length-i-1; //index of last Element after each step int MaxIndex = MaxIndex(arr,0,LastElementIndex); // index of maximum value, in the remaining unsorted array ...
<?php function compareByName($a, $b) { return strcmp($a->name, $b->name); } usort($cityPages->data, 'compareByName'); // $cityPages->data are the array which we want ...