I have the following array
$array = [
'2022-06-30',
'2022-04-20',
'2021-04-07',
'2022-09-09',
'2022-03-08',
'2021-08-07',
'2022-10-12'
];
and I want to sort every date in the past ASC and every date in the future DESC.
How can I do this?
With "today" being 2022-06-02, my expected result:
array (
0 => '2021-04-07', // before today, ASC
1 => '2021-08-07', // before today, ASC
2 => '2022-03-08', // before today, ASC
3 => '2022-04-20', // before today, ASC
4 => '2022-10-12', // after today, DESC
5 => '2022-09-09', // after today, DESC
6 => '2022-06-30', // after today, DESC
)