I have following arrays:
$array1 = "
Array (
[0] => Array (
[0] => Value1
[1] => Value2
)
[1] => Array (
[0] => Value3
[1] => Value4
)
[2] => Array (
[0] => Value5
[1] => Value6
)
...
[999] => Array (
[0] => Value7
[1] => Value8
)
)
and
$array2 = "
Array (
[0] => Array (
[0] => ValA
[1] => ValB
[2] => ValC
[3] => ValD
)
[1] => Array (
[0] => ValE
[1] => ValF
[2] => ValG
[3] => ValH
)
[2] => Array (
[0] => ValI
[1] => ValJ
[2] => ValK
[3] => ValL
)
...
[999] => Array (
[0] => ValM
[1] => ValN
[2] => ValO
[3] => ValP
)
)
I would like to merge both arrays so that in the end I have the same structure, number of keys in the first level, but the values would be "joined" in the second level just like we can see in the following result array:
$array3 = "
Array (
[0] => Array (
[0] => Value1
[1] => Value2
[2] => ValA
[3] => ValB
[4] => ValC
[5] => ValD
)
[1] => Array (
[0] => Value3
[1] => Value4
[2] => ValE
[3] => ValF
[4] => ValG
[5] => ValH
)
[2] => Array (
[0] => Value5
[1] => Value6
[2] => ValI
[3] => ValJ
[4] => ValK
[5] => ValL
)
...
[999] => Array (
[0] => Value7
[1] => Value8
[2] => ValM
[3] => ValN
[4] => ValO
[5] => ValP
)
)
I tried with array_merge and array_merge_recursive as showed in this solution: https://stackoverflow.com/a/16541831/3499881, but it didn't work.
Do I really have to convert all numeric keys to string or is it somehow also possible with that keys? If this is the only way, could you please show me how I can convert it?
Or is the problem caused because in the first array there are 2 keys and in the second 4?
I would appreciate any clue. Many thanks in advance.