While Loop Php Array Sorting Function