<?php $array1 = [ [10, 'Some Name..'], [11, 'Some Name..'], [13, 'Some Name..'], ]; $array2 = [ [13, 'Viewed'] ]; $result = []; foreach (array_merge($array1, $array2) as $row) { if (!isset($result[$row[0]])) { $result[$row[0]] = $row; } else { $result[$row[0]][] = $row[1]; } } var_export($result);
You have javascript disabled. You will not be able to edit any code.