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:
array(0=> array('attribute_name' => "Appliances", 'attribute_value' => array('Washer','Dryer','Diswasher')))array( 'Appliances' => array('Washer', 'Dryer', 'Dishwasher') )