I have two array both containing data. I want to be able to add them together so that the information from the second array joins into the first array. Currently the array_merge that I am doing adds the second array to the end of the first one.
Array 1
[1] => Array
(
[0] => 2017-07-13 00:00:00
[1] => Foo
[2] => Bar
[3] => 16.11
[4] => 80.56
[5] => 96.67
)
[2] => Array
(
[0] => 2017-07-13 00:00:00
[1] => Foo
[2] => Bar
[3] => 1.23
[4] => 50.69
[5] => 14.24
)
Array 2
[1] => Array
(
[0] => TIME
[1] => Lorem
[2] => Ipsum
)
[2] => Array
(
[0] => TIME
[1] => Some
[2] => Text
)
How can I Merge the two arrays so the output becomes like below?
Array 3
[1] => Array
(
[0] => 2017-07-13 00:00:00
[1] => Foo
[2] => Bar
[3] => 16.11
[4] => 80.56
[5] => 96.67
[6] => TIME
[7] => Lorem
[8] => Ipsum
)
[2] => Array
(
[0] => 2017-07-13 00:00:00
[1] => Foo
[2] => Bar
[3] => 1.23
[4] => 50.69
[5] => 14.24
[6] => TIME
[7] => Some
[8] => Text
)
What is currently happening
[1] => Array
(
[0] => 2017-07-14 00:00:00
[1] => Foo
[2] => Bar
[3] => 16.11
[4] => 80.56
[5] => 96.67
)
[2] => Array
(
[0] => 2017-07-14 00:00:00
[1] => Foo
[2] => Bar
[3] => 1.23
[4] => 50.69
[5] => 14.24
)
[3] => Array
(
[0] => TIME
[1] => Lorem
[2] => Ipsum
)
[4] => Array
(
[0] => TIME
[1] => Some
[2] => Text
)
I have tried array_merge( $array1 , $array2 ); but that adds the second array to the end of the first one.
Any ideas?
array_merge_recursive()?