I have an array with a series of event IDs organized like this: $event['year']['month']['day'] = $event_id (full structure below).
Basically, I want to output the next 5 events (or so) from a given date (such as today).
I've gone through the PHP manual, but haven't found a suitable solution. I suppose I could just iterate through each step, but there could be hundreds of events. If I knew the offset, I could use array_slice, but I'm not sure how to get the offset without looping through the entire array. If I could set the pointer, then I would just iterate through. But I gather there isn't a way to set a pointer in a PHP array.
A specific MySQL query isn't very feasible either since the data isn't well organized (this is using meta keys in a Wordpress database). I'd probably have to use a number of JOINs, so I think the performance hit would be bad.
Given the current year, month, and day (e.g., $event[$year][$month][$day], I want to just show the next 5 events.
The structure looks like this:
Array
(
[2010] => Array
(
[1] => Array
(
[1] => Array
(
[594] => "Event"
)
)
[2] => Array
(
[1] => Array
(
[592] => "Event",
[524] => "Event"
)
[2] => Array
(
[580] => "Event"
)
[2011] => Array
(
[1] => Array
(
[1] => Array
(
[587] => "Event"
)
)
)
)
Thoughts? Sorry if this description is a bit complicated. Thanks!
Edit: Typos