Tôi muốn có mảng $ sort_flags này có sẵn trong hàm compare_by_flags, nhưng tôi không tìm thấy cách này, có thể không?Làm cách nào để thêm tham số bổ sung vào hàm 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
}
Bạn sử dụng phiên bản php nào? – zerkms
5.2, nhưng sẽ nâng cấp sớm – Riesling