This seems like a relatively easy thing to do but I'm struggling a bit. Here is a bit of backstory. I'm currently making a schedule of events based off a web service.
Because of the way it outputs data I've been creating and rearranging the information based off the clients wants/needs.
I've created a time array that basically loops through the open hours in 15 min intervals. Example...
Array
(
[0600] => 0
[0615] => 0
[0630] => 0
[0645] => 0
[0700] => 0
[0715] => 0
[0730] => 0
[0745] => 0
[0800] => 0
[0815] => 0
[0830] => 0
[0845] => 0
[0900] => 0
...etc etc
[2300] => 0
)
Once I've done that I loop(using a foreach) through events and if the time is equal to a key add it to the array. The variables are just items from web service.
$timeArray[date('Hi', $roundStart)] = array(
'e_name' => $eventName,
'e_build_id' => $buildId,
'e_start' => $timeStampS,
'e_end' => $timeStampE,
'e_class' => $eClass,
'e_span' => $fullSpan,
'e_status' => $canCheck,
'e_lanes' => $lanesOpen
);
But I've noticed there is a bug with this and that if you have two events at the same time the last one will override the other one. What I need instead is for the events to be within the same key. So adding two or more arrays to the key.
Let me know if this makes sense?
$timeArray[date('Hi', $roundStart)] =to$timeArray[date('Hi', $roundStart)][] =. that way it will have array of events in each time key.array_push()to add the event arrays inside of the array stored for the key.