While Loop Php Array Sorting Javascript