$items = array(...);
$groupedItems = array();
foreach($items as $item) {
$groupedItems[$item['value']][] = $item;
}
SELECT
indexing_link.id,
indexing_link.url,
indexing_link.title,
indexing_link.short
FROM indexing_link, indexing_link_word, indexing_word
WHERE
(:searchWords)
AND indexing_word.word not in (:stopWords)
AND indexing_link_word.word_id=indexing_word.id
AND indexing_link.id=indexing_link_word.link_id
$groupMakesByWord = array();
foreach ($makes as $make) {
$groupMakesByWord[$make['word']][] = $make;
}
foreach ($groupMakesByWord as $makeWord => &$makes) {
uasort($makes, function($a, $b) {
if ($a['max_bid'] == $b['max_bid']) {
return 0;
}
return $a['max_bid'] < $b['max_bid'] ? 1 : -1;
});
}
unset($makes);
$result = array();
foreach ($groupMakesByWord as $makes) {
$result[] = current($makes);
}