我有一个多维数组,看起来像这样:
Array
(
[event] => Array
(
[group] => 1
[name] => Meetings
[time] => Array
(
[0] => Array
(
[room] => A
[label] => Meeting 100
[start] => 2016-09-07T14:30:00-04:00
[end] => 2016-09-07T15:00:00-04:00
)
[1] => Array
(
[room] => A
[label] => Meeting 100
[booking_start] => 2016-09-07T15:00:00-04:00
[booking_end] => 2016-09-07T15:30:00-04:00
)
[2] => Array
(
[room] => A
[label] => Meeting 200
[booking_start] => 2016-09-07T15:30:00-04:00
[booking_end] => 2016-09-07T16:00:00-04:00
)
[3] => Array
(
[room] => B
[label] => Meeting 300
[booking_start] => 2016-09-07T16:00:00-04:00
[booking_end] => 2016-09-07T16:30:00-04:00
)
[4] => Array
(
[room] => B
[label] => Meeting 300
[booking_start] => 2016-09-07T16:30:00-04:00
[booking_end] => 2016-09-07T17:00:00-04:00
)
)
)
)
每个“事件 - >时间”都有以1/2小时为增量列出的元素,导致会议跨越一个或多个阵列。我正在寻找一种有效的方法,根据“房间”和“标签”找到每个“时间”的第一个和最后一个实例,以便计算各个会议的开始和结束时间并返回“标签”, “房间”,实际开始时间和实际结束时间。任何人都可以提出一种可能运作良好的方法吗?