- array_merge: documentation ( source)
- var_export: documentation ( source)
<?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);