Reputation: 1480
I'm trying to find out which is the correct way to add associative data to an array of associative data.
I have something like this:
$values = array('data1' => $data1, 'data2' => $data2, => 'data3' => $data3 );
now what if I want to add for example $data4 as 'data4' to $values?
Should I use array_merge()
?
like $values = array_merge($values, array('data4', $data4));
or is there a better / more correct way?
Upvotes: 0
Views: 28