I have an array:
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
)
)
I want to produce:
Array
(
[0] => Array
(
[attribute_name] => Appliances
[attribute_value] => Washer, Dryer, Dishwasher, Microwave
)
[1] => Array
(
[attribute_name] => Console
[attribute_value] => Xbox360, PS3
)
)
How is this achieved in PHP?
Here’s my final code based on @andrewtweber’s original solution:
This will give you
http://codepad.org/m6l3je0H