0

Array 1

[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

Array 2

 [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

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?

Gordon
  • 312,688
  • 75
  • 539
  • 559
  • 4
    How do you think it can be achieved? We usually expect people to show us what they tried and where they are stuck, so we know they don't just want us to do their coding for them. – Gordon Jul 30 '13 at 16:58
  • Have a look at `array_merge` - http://php.net/manual/en/function.array-merge.php This will, *at the very least*, give you one big array with all the data. You can then filter the resulting array and perform the rest of your logic there. – Kirk Backus Jul 30 '13 at 17:20

0 Answers0