Php – sort dates array into years -> months
I have a list of dates in my database table e.g. "2023-12-03" "2023-12-10" "2023-12-17" "2024-01-07" "2024-01-14" "2024-01-21" I need this to be returned to front end in the following form: [1]=> array(2) { ["year"]=> string(4) "2024" ["months"]=> array(3) { [0]=>…