How to sort an array of times chronologically?

前端 未结 8 922
梦毁少年i
梦毁少年i 2021-01-17 18:39

I have a non-associative array where the data that comes in is not sorted (I\'m receiving the data from an outside system and cannot force it to come into the array in sorte

8条回答
  •  执念已碎
    2021-01-17 19:34

    Remove $wedTrackTimes = before sort.

     $wedTrackTimes = array("9:30 AM-10:30 AM", "8:15 AM-9:15 AM", "12:30 PM-1:30 PM", "2:00 PM-3:00 PM", "3:30 PM-4:30 PM");
     $wedTrackTimes = array_unique($wedTrackTimes);
     sort($wedTrackTimes);
     print_r($wedTrackTimes);
    

提交回复
热议问题