<?php $d = [array ( 77 => Array ( 'Bold Condensed', 'Bold Condensed 2', 'Bold Condensed 3' ) ), array ( 77 => array ( 'Bold Condensed' ), 136 => array ( 'Regular' ) ), array ( 77 => array ( 'Bold Condensed (1, 2, 3)' ), 168 => array ( 'Regular', 'Bold' ) )]; $result = []; foreach($d as $subs){ foreach($subs as $id => $values){ $result[ $id ] = array_merge($result[ $id ] ?? [], $values); } } $result = array_map(fn($v) => array_unique($v), $result); print_r($result);
You have javascript disabled. You will not be able to edit any code.