Yes, it is possible to combine filter_input() with AND/OR in PHP. This can be done by looping through the POST fields -
$value = filter_input(INPUT_POST, 'field', FILTER_DEFAULT, is_array($_POST['field']) ? FILTER_REQUIRE_ARRAY : NULL);
The equivalent for the same user for each loop would look like this -
$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}); } }
The above is the detailed content of Can I use PHP's filter_input() filter flag with AND/OR?. For more information, please follow other related articles on the PHP Chinese website!