Hi, I hope someone can help me...
I'm building a stats system for my company and have come to a bit of a halt regarding array merges.
I currently had 2 arrays which i pull out of the database looking like something like this
Array 1
Country_ID Count
GB 698
US 167
NL 2
SE 2
EU 1
LU 1
Array 2
Country_ID Count
GB 4295
US 910
NL 10
EU 5
DE 4
SE 3
FR 3
CA 2
And im trying to write a function that would work like this
$array_output = merge_array($array1, $array2);
Combining both arrays and their values outputting something like
Country_ID Count
GB 4993
US 1077
NL 12
EU 6
SE 5
DE 4
FR 3
CA 2
LU 1
It also needs to work with other arrays but they are always in the same format (i.e. key and numeric value) ...
e.g.
OS_ID Count
NT 5.1 661
WIN 98 62
NT 5 62
or
Provider_ID Count
Google 472
Ask 87
AOL 5
I am completely stuck on how to approach this, at first I thought a simple array_merge or array_merge_recursive would work but all php's array functions either overwrite the values or append them...
I would be eternally grateful if someone could help me out with this, i've been trying to figure it out for days and now i have steam coming out of my ears.
Thanks