Now, that is TOTALLY different that what you originally asked.

So, just sort the contents of the array then step through the sorted array and move each element to a new array.

Is the contents of the array a string, number etc???