1

I have an array like this:

array:6 [▼
 "2016-07-28" => array:18 [▶]
 "2016-07-29" => array:18 [▶]
 "2016-07-30" => array:5 [▶]
 "2016-07-31" => array:5 [▶]
 "2016-08-01" => array:17 [▶]
 "2016-08-02" => array:11 [▶]
]

I know want to revert the order, having 2016-08-02 the first and 2016-07-28 the last entry.

I tried

asort($missingArr);

Result

array:6 [▼
 "2016-07-29" => array:18 [▶]
 "2016-07-28" => array:18 [▶]
 "2016-08-01" => array:17 [▶]
 "2016-08-02" => array:11 [▶]
 "2016-07-31" => array:5 [▶]
 "2016-07-30" => array:5 [▶]
]

Even when converting the date to a unix timestamp it does the exact same thing. Where am I wrong?

PrimuS
  • 2,505
  • 6
  • 33
  • 66

1 Answers1

1

With krsort (k stands for "key", r for "reverse"):

krsort($missingArr);
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125