3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ 2 => [130, 28, 1, 1, 6], 3 => [52, 2, 3, 3, 27], 13 => [41, 20, 27, 13, 37] ]; $array2 = [89, 99, 109]; $counter = 0; foreach ($array1 as $index => $subArray) { $array1[$index][] = $array2[$counter++]; } print_r($array1);

preferences:
27.65 ms | 404 KiB | 5 Q