I'd like to combine the two arrays below into one. More specifically, I want to add the contents of the second array to the the matching key in the first array. The keys in the final array should have contents of matching keys of both arrays.
Array (
[123456789_404045862944400] => 192
[123456789_403274909688162] => 186
[123456789_402735273075459] => 311
[123456789_252948031457462] => 385
[123456789_400606749954978] => 287
[123456789_286755318061725] => 358
[123456789_399687880046865] => 257
[123456789_398332190182434] => 240
[123456789_397768486905471] => 311
[123456789_396907650324888] => 293
[123456789_394850557197264] => 496
[123456789_394121230603530] => 475
[123456789_369757766367627] => 488
[123456789_391602517522068] => 506
[123456789_390848830930770] => 437
[123456789_389975351018118] => 452
[123456789_242486689170043] => 525
[123456789_388151047867215] => 415
[123456789_387476447934675] => 502
[123456789_386620518020268] => 467
[123456789_215937481836499] => 359
)
Array (
[123456789_404045862944400] => 23:52
[123456789_403274909688162] => 22:21
[123456789_402735273075459] => 04:29
[123456789_252948031457462] => 06:22
[123456789_400606749954978] => 05:01
[123456789_286755318061725] => 04:51
[123456789_399687880046865] => 21:51
[123456789_398395260176127] => 01:13
[123456789_398332190182434] => 23:19
[123456789_397768486905471] => 05:38
[123456789_397509266931393] => 00:46
[123456789_396907650324888] => 03:38
[123456789_394850557197264] => 05:12
[123456789_394121230603530] => 04:15
[123456789_369757766367627] => 04:01
[123456789_391602517522068] => 03:44
[123456789_390848830930770] => 06:05
[123456789_389975351018118] => 04:00
[123456789_242486689170043] => 04:13
[123456789_388151047867215] => 00:22
[123456789_387544787927841] => 07:34
[123456789_387476447934675] => 04:51
[123456789_386620518020268] => 06:05
[123456789_386504878031832] => 02:38
[123456789_215937481836499] => 01:10
)
What I've tried so far:
$array1 = array_merge($array1, $array2);
Also tried something like:
foreach($arr2 as $k=>$v) {
$a[$k] = $arr1[$k];
}
But it it doesn't combine/merge the arrays correctly be matching keys.
I also tried it with array_combine
but since it creates an array by using one array for keys and another for its values I couldn't get that to work either.