我希望在compare_by_flags函數中有這個$ sort_flags數組,但我沒有找到辦法解決這個問題,有可能嗎?如何添加其他參數到usort/uasort cmp函數?
public function sort_by_rank(array $sort_flags = array()) {
uasort($this->search_result_array, array($this, 'compare_by_flags'));
}
private static function compare_by_flags($a, $b) {
// I want to have this $sort_flags array here to compare according to those flags
}
你使用什麼PHP版本? – zerkms
5.2,但很快就會升級 – Riesling