Which one of the following filter is used to filter several variables with the same or different filters?
Correct answer
A. filter_var_array()
14 views
A. filter_var_array()
14 views
filter_var_array() takes an array of variables and applies either one filter to all of them or a different filter to each key, returning the filtered values in a single call.
By comparison, filter_var() handles only one variable, while filter_input() and filter_input_array() read values from external sources such as $_GET and $_POST. Knowing which filter function fits which job is a common PHP interview and test question.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.