dok300
-
Posts
2 -
Joined
-
Last visited
Posts posted by dok300
-
-
I have a multidimensional array like so.
Array ( [0] => Array ( [0] => Yolo County Sheriff's Home 2008faroo [1] => http://www.yolosheriffs.com/ [2] => 86 ) [1] => Array ( [0] => Fremont, Yolo County, California - Wikipedia, the free encyclopediafaroo [1] => http://en.wikipedia.org/wiki/Fremont,_Yo… [2] => 11 ) [2] => Array ( [0] => The Lonely Island - YOLO (feat. Adam Levine & Kendrick Lamar) - YouTubefaroo [1] => http://www.youtube.com/watch?feature=pla… [2] => 45 )
What i need to do is find duplicate urls in this array, merge them together and combine the score found at [2]. I have scoured the php manual but I can't seem to find a way to merge the duplicate urls and then add the scores to the remaining url. Would it make it any easier to have it in the format
Array ( [0] => Array ( [0] => Yolo County Sheriff's Home 2008faroo, array([0] => http://www.yolosheriffs.com/ ,[1] => 0) )
?? All suggestions appreciated.I have looked at the manual but i don't have the knowledge at this stage to use the array functions in conjunction with foreach loops to achieve what i need.I
Merging elements of an multidimensional array together and incrementing value.
in PHP Coding Help
Posted
This is simply fantastic, after spending a day and a half looking up arr_diff_assoc etc in the manual and getting decimated on SO it gets solved in about 15 minutes. Thanks.