Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$arr1 = [
33 => [
0 => 30319,
1 => 30318,
2 => 30315
],
32 => [
0 => 21300,
1 => 45988
]
];
$arr2 = [
33 => [
0 => 50209,
1 => 50149
],
34 => [
0 => 12345,
1 => 34567
]
];
$res = [];
foreach(array_merge(array_keys($arr1), array_keys($arr2)) as $k) {
$res[$k] = array_merge(
$arr1[$k] ?? [],
$arr2[$k] ?? []
);
}
print_r($res);