【发布时间】:2014-11-13 17:05:29
【问题描述】:
我有一个如下所示的数组:
Array (
[0] => Array
(
[id] => 1
[day] => 12
[month] => 10
[year] => 2014
[event_title] => numbwe1
[event] => trip to this place unknown
)
[1] => Array
(
[id] => 2
[day] => 16
[month] => 10
[year] => 2014
[event_title] => number2
[event] => trip to this other place unknown
)
)
我想让它看起来像这样
Array (
[2014] => Array (
[10] => Array (
[1] => Array(
[0] => Array(
[event_title] = numbwe1
[event] = trip to this place unknown
)
)
[2] => Array(
[0] => Array(
[event_title] = number2
[event] = trip to this other place unknown
)
)
)
)
)
我不知道是因为它迟到了,还是因为它很复杂,但我无法理解它。任何人都有任何想法。
目的是我希望能够根据年份 => 月份 => 日期 =>
选择所有事件例如。 $events[2014] 给出了今年的所有事件。
$events[2014][11] 给出了本月的所有事件。
$events[2014][11][13] 提供当天的所有事件。
也欢迎其他解决方案。
【问题讨论】:
标签: php arrays codeigniter activerecord