我有一個多維數組的形式;整理多維數組值
Array
(
[0] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Holiday
[DURATION] => 04:00
)
[1] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Work
[DURATION] => 05:00
)
[2] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Holiday
[DURATION] => 06:00
)
[3] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Work
[DURATION] => 05:00
)
[4] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Holiday
[DURATION] => 02:00
)
[5] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Work
[DURATION] => 03:00
)
[6] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Holiday
[DURATION] => 03:00
)
[7] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Work
[DURATION] => 02:00
)
)
想整理結果,總結每個人的假期和工作,以便我可以輸出一些東西的形式;
Array
(
[0] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Holiday
[DURATION] => 10:00
)
[1] => Array
(
[DATE] => 05-19-2011
[PERSON] => Bob Hope
[ITEM] => Work
[DURATION] => 10:00
)
[2] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Holiday
[DURATION] => 05:00
)
[3] => Array
(
[DATE] => 05-19-2011
[PERSON] => Joe Bloggs
[ITEM] => Work
[DURATION] => 05:00
)
)
任何想法?任何和所有幫助表示讚賞。
有什麼區別? – jantimon 2011-06-08 08:22:56
他將他們分組Bob Hope的假期合併,第二個例子的DURATION爲10。 – tradyblix 2011-06-08 08:24:37
@Ghommey [DURATION]加起來就是[ITEM]的唯一條目,而[NAME] – 2011-06-08 08:25:40