I have two arrays with same indexes, and unfortunately array_merge_recursive doesn't work for me.
First array is like this:
$firstarray = array(
0 => array('id' => 1, 'name' => 'John Smith'),
1 => array('id' => 2, 'name' => 'Jane Doe')
);
Where second array is:
$secondarray = array(
0 => array('email' => 'john@smith.com'),
1 => array('email' => 'jane@doe.com')
);
Desired output would be like this,
Array
(
[0] => Array
(
[id] => 1
[name] => John Smith
[email] => john@smith.com
)
[1] => Array
(
[id] => 2
[name] => Jane Doe
[email] => jane@doe.com
)
)
But I am getting second array items appended to original array like this:
Array
(
[0] => Array
(
[id] => 1
[name] => John Smith
)
[1] => Array
(
[id] => 2
[name] => Jane Doe
)
[2] => Array
(
[email] => john@smith.com
)
[3] => Array
(
[email] => jane@doe.com
)
)