<?php $collections = [ 0 => [ 0 => [ "attr_id" => 23, "value" => "Single Side" ], 1 => [ "attr_id" => 23, "value" => "Double Side" ], ], 1 => [ 0 => [ "attr_id" => 31, "value" => "A4" ], 1 => [ "attr_id" => 31, "value" => "12x18" ], 2 => [ "attr_id" => 31, "value" => "B5" ], 3 => [ "attr_id" => 31, "value" => "A5" ] ] ]; $expected = []; foreach($collections as $k=>$v){ foreach($v as $k1=>$v1){ $expected[$v1['attr_id']][] = $v1['value']; } } print_r($expected) ?>
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`