Reputation: 2217
I have the following case in php
$one = array('one' => 1, 2 => array('intro'=> 'something', 'short' => 'short'));
$two = array('intro' => 'something_new');
$three = array_merge($one,$two);
what I wanted to do is to change the one[2][intro] to two[intro] what it does is append the "two" array into the "one"
How I could change the value of the first array with the second ones by knowing only the key but not in which level is this key?
Upvotes: 1
Views: 1042
Reputation: 22810
What about :
$new_two = array_merge($one[2],$two)
$one[2] = $new_two;
Upvotes: 4