我有一個數組:關聯數組:如何擺脫重複?
Array
(
[0] => Array
(
[attribute_name] => Appliances
[attribute_value] => Washer
)
[1] => Array
(
[attribute_name] => Appliances
[attribute_value] => Dryer
)
[2] => Array
(
[attribute_name] => Appliances
[attribute_value] => Dishwasher
)
[3] => Array
(
[attribute_name] => Appliances
[attribute_value] => Microwave
)
[4] => Array
(
[attribute_name] => Console
[attribute_value] => Xbox360
)
[5] => Array
(
[attribute_name] => Console
[attribute_value] => PS3
)
)
我想生產:
Array
(
[0] => Array
(
[attribute_name] => Appliances
[attribute_value] => Washer, Dryer, Dishwasher, Microwave
)
[1] => Array
(
[attribute_name] => Console
[attribute_value] => Xbox360, PS3
)
)
這是如何在PHP中實現?
這裏的基礎上@ andrewtweber原來的解決方案我的最終代碼:
[你嘗試過什麼?( http://whathaveyoutried.com) –
將重複ES總是成對出現?重複將始終連續?會不會有雙? – Ryan
@MarkReed - 以前從未看過那個鏈接,從現在開始不得不使用它。 :) – Duniyadnd