function find_best($better, $coll) { foreach($coll as $key=>$value) { if( is_null($best) || $better($value,$best[1]) ) { $best = array($key, $value); } } return $best; }