次のコードは、URL とスコアで埋められた 3 つの配列を結合します。URL が一致する場合、スコアが一緒に追加されて新しい配列が作成されます。結合された配列に降順でランク付けされたリストを作成しようとしていますが、その方法がよくわかりません
<?php
$combined = array();
foreach($bingArray as $key=>$value){ // for each bing item
if(isset($combined[$key]))
$combined[$key] += $value['score']; // add the score if already exists in $combined
else
$combined[$key] = $value['score']; // set initial score if new
}
// do the same for google
foreach($googleArray as $key=>$value){
if(isset($combined[$key]))
$combined[$key] += $value['score'];
else
$combined[$key] = $value['score'];
}
// do the same for bing
foreach($bingArray as $key=>$value){
if(isset($combined[$key]))
$combined[$key] += $value['score'];
else
$combined[$key] = $value['score'];
}
array_multisort($value['score'], SORT_DESC,$combined);
print_r($combined); // print results
?>
以下は、私が現在得ている出力です
Warning: array_multisort() [function.array-multisort]:
Argument #1 is an unknown sort flag in /homepublic_html/agg_results.php on line 230
Array ( [time.com/time/] => 200 [time.gov/] => 297 [timeanddate.com/worldclock/]
=> 294 [timeanddate.com/] => 194 [en.wikipedia.org/wiki/Time] => 289
[worldtimezone.com/] => 190 [time100.time.com/]=> 188
[time.gov/timezone.cgi? Eastern/d/-5/java]
=> 186 [en.wikipedia.org/wiki/Time_(magazine)]
=> 275 [dictionary.reference.com/browse/time] => 182 [time.com/]
=> 100 [time.com/time/magazine]
=> 96 [time.is/] => 95 [tycho.usno.navy.mil/cgi-bin/timer.pl]
=> 94 [twitter.com/TIME] => 93 [worldtimeserver.com/] => 92 )
どんな助けでも素晴らしい男と人形になるでしょう