2
I own the array y
where in your index 0
holds the values App
and Views
array (size=1)
0 =>
array (size=2)
0 => string 'App' (length=3)
1 => string 'Views' (length=5)
In the 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
, when using array_merge
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 it should 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 in ideone
Put the ideone code in the question :)
– rray
Would that be so? https://ideone.com/IWahLp
– Rafael Withoeft
@rray Ops! Edited!
– Marcelo de Andrade
Apparently yes, @Rafaelwithoeft
– Marcelo de Andrade