Merging multidimensional arrays - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Merging multidimensional arrays

oneshot2shotsoneshot2shots Posts: 2Member
Array 1

[code][0] => Array
(
[0] => Urban Dictionary - yolo
[1] => http://www.urbandictionary.com/define.php?term=yolo
[2] => 3
)

[1] => Array
(
[0] => YOLO Colorhouse - Low Odor, Zero VOC Interior Paint with Artist-Crafted Color Palette
[1] => http://www.yolocolorhouse.com/
[2] => 2
)

[2] => Array
(
[0] => Yolo County - Home
[1] => http://www.yolocounty.org/
[2] => 9
[/code]
Array 2

[code][0] => Array
(
[0] => Yolo Is Intel’s First Smartphone for Africa
[1] => http://mashable.com/2013/01/25/intel-yolo/
[2] => 65

[1] => Array
(
[0] => YOLO Colorhouse - Low Odor, Zero VOC Interior Paint with Artist-Crafted Color Palette
[1] => http://www.yolocolorhouse.com/
[2] => 6
)

[2] => Array
(
[0] => Yolo County - Home
[1] => http://www.yolocounty.org/
[2] => 43
[/code]
I want to merge the arrays above, in such a way that

(i) If the urls are identical, replace one (or alternatively just delete one of the urls) (ii) When the urls are identical add the score to the new url. So if i had 50 arrays in one array, 50 in the other and with 10 of them having identical urls, then the merged array would have a total of 90 results with 10 of them having an increased score. The above example merged would have 4 arrays with YOLO count home having a score of 52.

Can anyone advise on how to go about this?
Sign In or Register to comment.