ฉันมีรหัสต่อไปนี้:
function lower_than_10($i) {
return ($i < 10);
}
ที่ฉันสามารถใช้เพื่อกรองอาร์เรย์เช่นนี้:
$arr = array(7, 8, 9, 10, 11, 12, 13);
$new_arr = array_filter($arr, 'lower_than_10');
ฉันจะเพิ่มอาร์กิวเมนต์ให้กับ lower_than_10 เพื่อให้ยอมรับหมายเลขที่จะตรวจสอบได้อย่างไร เช่นถ้าฉันมีสิ่งนี้:
function lower_than($i, $num) {
return ($i < $num);
}
จะเรียกมันจาก array_filter ผ่าน 10 ถึง $ num หรือหมายเลขอะไรก็ได้