Let's say that I have two arrays like this:
$arr1 = array(
array('position' => 1),
array('position' => 2),
array('position' => 3),
array('position' => 4),
array('position' => 5),
array('position' => 6),
array('position' => 7)
);
$arr2 = array(
array(
'a' => 'A1',
'b' => 'B1',
'c' => 'C1'
),
array(
'a' => 'A2',
'b' => 'B2',
'c' => 'C2'
),
array(
'a' => 'A3',
'b' => 'B3',
'c' => 'C3'
)
);
The goal is to have a resulting array where the key position from the first array is copied to each array in the second array like this:
$final_arr = array(
array(
'a' => 'A1',
'b' => 'B1',
'c' => 'C1',
'position' => 1
),
array(
'a' => 'A2',
'b' => 'B2',
'c' => 'C2',
'position' => 2
),
array(
'a' => 'A3',
'b' => 'B3',
'c' => 'C3',
'position' => 3
)
);
Why can't I just do this with array_merge? Any idea?
NOTE As you can see above, the arrays don't have the same length
Thank you for any help