merge 2 php arrays - without ignoring duplicate keys

Joined
12 Feb 2006
Posts
17,383
Location
Surrey
i have the below code. i want to merge the 2 arrays so that all the lines are included, however at the moment duplicate keys are being ignored, so key 1 and 2 from the GRP array is not included.

How should write the below so that the duplicate keys aren't ignored? This is a very simplified version, as i actually have 5 more arrays and depending on various situations will depend on which arrays are included, so i can't be sure which number key each will be.

PHP:
// DEALS FOR ALL SITES
$dealLineupMain = array(
    1  => "deal4",  
    2  => "deal9", 
);


// JUST GROUP SITE
$dealLineupGRP = array(
    1  => "deal6",  
    2  => "deal8", 
    3  => "deal10", 
);

$dealLineup = $dealLineupMain + $dealLineupGRP;
 
Back
Top Bottom