I need help to combine multiple arrays. For example, I have 2 different arrays.
$array1 contains the id and amount. $array2 will have the date and the amount base on the id.
$array1 = [
310 => 0,
311 => 0,
312 => 0,
313 => 0,
314 => 0,
315 => 0
];
$array2 = [
"2019-05-17" => [
312 => 3000.00
],
"2019-06-20" => [
312 => 3000.00
],
"2019-06-27" => [
313 => 5000.00,
315 => 3000.00
]
];
Final output that I want:
$merge = [
"2019-05-17" => [
310 => 0,
311 => 0,
312 => 3000.00,
313 => 0,
314 => 0,
315 => 0
],
"2019-06-20" => [
310 => 0,
311 => 0,
312 => 3000.00,
313 => 0,
314 => 0,
315 => 0
],
"2019-06-27" => [
310 => 0,
311 => 0,
312 => 0,
313 => 5000.00,
314 => 0,
315 => 3000.0
],
];
May I know how to achieve it so that I will get like the $merge?