so here is what I'm trying to do. I have structured a list of locations and dates in an multi-dim array. and I want to show the next 3 upcoming dates in the output based on date and location. Also I need to show only one date per location at any given moment so basically the closest date from location 1, 2 and 3 and so on, and every time one of them is passed I want to replace it with the next closest one. I might need to add more location later on but I still need to show the first 3 upcoming dates on the output. Should I structure my array differently?
Any help would be appreciated
Thanks
$event_dates = array(
'location-1' => array(
'date1' => array(
'start' => date('m-d-Y',strtotime('2017-7-30')),
'end' => date('m-d-Y',strtotime('2017-8-3')),
),
'date2' => array(
'start' => date('m-d-Y',strtotime('2018-2-18')),
'end' => date('m-d-Y',strtotime('2018-2-23')),
),
'date3' => array(
'start' => date('m-d-Y',strtotime('2018-7-29')),
'end' => date('m-d-Y',strtotime('2018-8-2')),
),
'date4' => array(
'start' => date('m-d-Y',strtotime('2019-1-27')),
'end' => date('m-d-Y',strtotime('2019-1-31')),
),
'date5' => array(
'start' => date('m-d-Y',strtotime('2019-7-28')),
'end' => date('m-d-Y',strtotime('2019-8-12')),
),
'date6' => array(
'start' => date('m-d-Y',strtotime('2020-1-16')),
'end' => date('m-d-Y',strtotime('2020-1-22')),
)
),
'location-2' => array(
'date1' => array(
'start' => date('m-d-Y',strtotime('2017-7-30')),
'end' => date('m-d-Y',strtotime('2017-8-13')),
),
'date2' => array(
'start' => date('m-d-Y',strtotime('2018-1-8')),
'end' => date('m-d-Y',strtotime('2018-2-11')),
),
'date3' => array(
'start' => date('m-d-Y',strtotime('2018-7-23')),
'end' => date('m-d-Y',strtotime('2018-8-12')),
),
'date4' => array(
'start' => date('m-d-Y',strtotime('2019-1-17')),
'end' => date('m-d-Y',strtotime('2019-1-23')),
),
'date5' => array(
'start' => date('m-d-Y',strtotime('2020-6-16')),
'end' => date('m-d-Y',strtotime('2020-6-22')),
)
),
'location-3' => array(
'date1' => array(
'start' => date('m-d-Y',strtotime('2017-5-12')),
'end' => date('m-d-Y',strtotime('2017-5-19')),
),
'date2' => array(
'start' => date('m-d-Y',strtotime('2018-9-22')),
'end' => date('m-d-Y',strtotime('2018-9-28')),
),
'date3' => array(
'start' => date('m-d-Y',strtotime('2018-3-12')),
'end' => date('m-d-Y',strtotime('2018-3-20')),
),
'date4' => array(
'start' => date('m-d-Y',strtotime('2019-12-9')),
'end' => date('m-d-Y',strtotime('2019-12-15')),
),
'date5' => array(
'start' => date('m-d-Y',strtotime('2020-11-16')),
'end' => date('m-d-Y',strtotime('2020-11-20')),
)
));