I have an array with date, status and summ:
Array
(
[0] => Array
(
[date] => 2019-07-06 14:01:52
[status] => paid
[summ] => 100
)
[1] => Array
(
[date] => 2019-07-02 12:22:31
[summ] => 320
[status] => pending
)
[2] => Array
(
[date] => 2019-07-01 18:43:58
[summ] => 100
[status] => pending
)
[3] => Array
(
[date] => 2019-06-26 14:01:52
[status] => canceled
[summ] => 200
)
i need to sort this array by status first (1.pending, 2.paid, 3.canceled), and then by date (new at the top).
Order which i nedd:
pending 2019-07-02 12:22:31 pending 2019-07-01 18:43:58 paid 2019-07-06 14:01:52 canceled 2019-06-26 14:01:52
with date i don't have any problems:
usort($new11, function($a, $b) {
return strtotime($b['date']) - strtotime($a['date']);
});
But how to sort by status in order which i need?
Thanx:)