ใช่ เป็นไปได้ที่จะรวม filter_input() กับ AND/OR ใน PHP สิ่งนี้สามารถทำได้โดยการวนซ้ำฟิลด์ POST -
$value = filter_input(INPUT_POST, 'field', FILTER_DEFAULT, is_array($_POST['field']) ? FILTER_REQUIRE_ARRAY : NULL);
แสดงค่าที่เทียบเท่ากับผู้ใช้คนเดียวกันสำหรับแต่ละลูปด้านล่าง−
$memory = array();
//looping through all posted values
foreach($_POST as $key => $value) {
//applying a filter for the array
if(is_array($value)) {
$ memory [$key] = filter_input(INPUT_POST, $key, {filters for array});
}
else {
$ memory [$key] = filter_input(INPUT_POST, $key, {filters for scalar});
}
}