Sorts an array using a stable sorting algorithm while preserving its keys.
A stable sorting algorithm maintains the relative order of values with equal keys.
The array is always sorted in ascending order but one can use the array_reverse() function to reverse the array. Also keys are preserved, even numeric ones, use the array_values() function to create an array with an ascending index.
Located at helpers.php