How to sort an array of times chronologically?

前端 未结 8 1003
梦毁少年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:24

    Sort works by reference (that means it sorts whatever you pass to it), it returns true/false based on failure. What you're doing here:

    $wedTrackTimes = sort($wedTrackTimes);
    

    is assigning the value $wedTrackTimes to TRUE or FALSE.

    Try

    sort($wedTrackTimes);
    print_r($wedTrackTimes);
    

提交回复
热议问题