I am trying to set the values of an empty array with another array (based on rows returned from a database).
I have tried a few things like array_merge but I just end up adding to the first array.
Just curious if there is a way to do this or would I need to iterate thought each array and merge them?
The second array can have between 1 and 3 arrays in it, while the first (the "empty") array has 3 elements always.
Empty array
(
[0] => Array
(
[id] =>
[quote_id] =>
...
)
[1] => Array
(
[id] =>
[quote_id] =>
...
)
[2] => Array
(
[id] =>
[quote_id] =>
...
)
)
Array I want to copy data from
Array
(
[0] => Array
(
[id] => 1
[quote_id] => 1
...
)
[1] => Array
(
[id] => 2
[quote_id] => 1
...
)
)
What I want to achieve
Array
(
[0] => Array
(
[id] => 1
[quote_id] => 1
...
)
[1] => Array
(
[id] => 2
[quote_id] => 1
...
)
[2] => Array
(
[id] =>
[quote_id] =>
...
)
)