I have two arrays like this:
array1
2 => string '3' (length=1)
3 => string '1' (length=1)
5 => string '2' (length=1)
6 => string '3' (length=1)
4 => string '2' (length=1)
and
array2
2 => string '1' (length=1)
3 => string '1' (length=1)
5 => string '1' (length=1)
6 => string '2' (length=1)
7 => string '1' (length=1)
I need to combine these two into one array. If the second array’s key is exist in first array keep second array’s values with the key.So result will be:
arrayResult
2 => string '1' (length=1)
3 => string '1' (length=1)
5 => string '1' (length=1)
6 => string '2' (length=1)
7 => string '1' (length=1)
4 => string '2' (length=1)
So how to combine these two array like above example?
Enter the array union operator: