I have the array y
where in its index 0
has the values App
and Views
array (size=1)
0 =>
array (size=2)
0 => string 'App' (length=3)
1 => string 'Views' (length=5)
No x
I have a array
with N
values
array (size=1)
0 => 'a'
1 => 'b'
...
And I want to add them to the first index of array
x
, while using array_merge
I do not get the expected result:
array (size=1)
0 =>
array (size=2)
0 => string 'App' (length=3)
1 => string 'Views' (length=5)
1 => 'a'
2 => 'b'
When should it be:
array (size=1)
0 =>
array (size=2)
0 => string 'App' (length=3)
1 => string 'Views' (length=5)
2 => string 'a'
...
Example:
$ranking[] = ['App', 'Views'];
$options[] = ['A', 'B'];
$merge = array_merge($ranking, $options);
$merge2 = array_merge($ranking[0], $options);
var_dump($merge);
var_dump($merge2);
Example on ideone