0
陣列我有兩個數組像下面金額和合並在php
Array
(
[0] => Array
(
[taskcount] => 3
[client_id] => 1
[client_name] => No Project Set
)
[1] => Array
(
[taskcount] => 1
[client_id] => 4
[client_name] => Check
)
[2] => Array
(
[taskcount] => 1
[client_id] => 5
[client_name] => Others
)
)
和
Array
(
[0] => Array
(
[taskcount] => 1
[client_id] => 5
[client_name] => Others
),
[1] => Array
(
[taskcount] => 1
[client_id] =>7
[client_name] => Othersnew
)
)
,我想合併兩個數組,以返回一些東西一樣,意味着我要總結taskcount如果兩個數組都有共同點client_id
Array
(
[0] => Array
(
[taskcount] => 3
[client_id] => 1
[client_name] => No Project Set
)
[1] => Array
(
[taskcount] => 1
[client_id] => 4
[client_name] => Check
)
[2] => Array
(
[taskcount] => 2
[client_id] => 5
[client_name] => Others
)
[3] => Array
(
[taskcount] => 1
[client_id] =>7
[client_name] => Othersnew
)
)
聽起來像一個有趣的遞歸問題,這將會是很高興看到你的第一次嘗試。對不起,強制性的*看到你的第一次嘗試,除了你想要的結果 – Bryan
你必須結合使用'array_uintersect()'(http://www.php.net/manual/en/function.array-uintersect.php)用'array_merge()'。 – hindmost