嗨,我有 2 个数组,例如
array(a) { [0]=> array(2) { ["count"]=> string(2) "22" ["hour"]=> string(1) "0" }
[1]=> array(2) { ["count"]=> string(2) "17" ["hour"]=> string(1) "1" }
[2]=> array(2) { ["count"]=> string(2) "22" ["hour"]=> string(1) "2" }
[3]=> array(2) { ["count"]=> string(2) "15" ["hour"]=> string(1) "3" }
[4]=> array(2) { ["count"]=> string(2) "15" ["hour"]=> string(1) "4" }
}
我有第二个具有不同(计数)值的数组
array(b) { [0]=> array(2) { ["count"]=> string(2) "12" ["hour"]=> string(1) "0" }
[1]=> array(2) { ["count"]=> string(2) "36" ["hour"]=> string(1) "1" }
[2]=> array(2) { ["count"]=> string(2) "59" ["hour"]=> string(1) "2" }
[3]=> array(2) { ["count"]=> string(2) "5" ["hour"]=> string(1) "3" }
[4]=> array(2) { ["count"]=> string(2) "27" ["hour"]=> string(1) "4" }
}
您能告诉我如何获得两个数组的 ["count"] 的总和并获得一个新数组,例如
array(c) { [0]=> array(2) { ["count"]=> string(2) "34" ["hour"]=> string(1) "0" }
[1]=> array(2) { ["count"]=> string(2) "53" ["hour"]=> string(1) "1" }
[2]=> array(2) { ["count"]=> string(2) "81" ["hour"]=> string(1) "2" }
[3]=> array(2) { ["count"]=> string(2) "20" ["hour"]=> string(1) "3" }
[4]=> array(2) { ["count"]=> string(2) "42" ["hour"]=> string(1) "4" }
}
谢谢你。