So $tr['tree']
is an array. $dic
is an array stored as key values. I want to add the key source
to that those arrays. It looks like the following code doesn't work as expected as I'm guessing $dic
is a new instance of the array object inside $tr['tree']
.
foreach($tr['tree'] as $dic){
$dic['source'] = $tr['source']." > ".$dic['name'];
}
Note, I'm coming from python where this would work brilliantly. So how would I do this in PHP?