I have an array that looks like this:
( [0] => 03-11-2013 [1] => 04-09-2016 )
How do I order it so that the greatest date always comes first?
Thanks
I have an array that looks like this:
( [0] => 03-11-2013 [1] => 04-09-2016 )
How do I order it so that the greatest date always comes first?
Thanks
Here's one:
array_multisort(array_map('strtotime', $array), SORT_DESC, $array);
Convert to timestamps and sort descending, sorting the original array. Might be better to have them as timestamps or YYYY-MM-DD
if you control the array creation.