我不确定在这方面要搜索什么功能,所以似乎无法帮助自己。看起来确实是一个明显的问题。我有一个数组,在我有重复键的地方,我希望添加这些值。例如:
这是我阵列的一部分。
[1] => Array
(
[inputAvg] => 21.41 KB
[outputAvg] => 22.03 KB
[date] => 2011-08-01
)
[2] => Array
(
[inputAvg] => 182.63 KB
[outputAvg] => 186.05 KB
[date] => 2011-08-01
)
[3] => Array
(
[inputAvg] => 182.63 KB
[outputAvg] => 186.05 KB
[date] => 2011-08-02
)
[4] => Array
(
[inputAvg] => 4.84 MB
[outputAvg] => 4.93 MB
[date] => 2011-08-03
)
我想要做的是,说数组的日期键是相同的(例如,这里是 2011-08-01)我想显示这个日期一次,但是重复项的组合值......?
例如
[1] => Array
(
[inputAvg] => 204.04 KB
[outputAvg] => 208.08 KB
[date] => 2011-08-01
)
[2] => Array
(
[inputAvg] => 182.63 KB
[outputAvg] => 186.05 KB
[date] => 2011-08-02
)
[3] => Array
(
[inputAvg] => 4.84 MB
[outputAvg] => 4.93 MB
[date] => 2011-08-03
)