Merge array into another array

I need to merge an associative array into another associative array. I know php’s array_merge but it returns a new array. That’s not what I want.

Eg

$ar1 = array('one'=>1, 'two'=>2, 'three'=>3);
$ar2 = array('four'=>4, 'five'=>5);

I want to know that is there a php function which I can use to merge $ar2 into $ar1. The result should be,

$ar1 = array('one'=>1, 'two'=>2, 'three'=>3, 'four'=>4, 'five'=>5);

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories