PHP Filters | PHP Questions

Que. How many types of filtering are present in PHP?
a. 3
b. 2
c. None
d. 4


Answer: 2


Que. What will be the output of the following PHP code?
<?php>
$num = "123";
if (!filter_var($num, FILTER_VALIDATE_INT))
    echo("Integer is not valid");
else
    echo("Integer is valid");
?>
a. Integer is valid
b. Error
c. Integer is not valid
d. No output is returned
Answer: Integer is valid


Que. Which one of the following filter is used to filter several variables with the same or different filters?
a. filter_input_array
b. filter_var_array()
c. filter_var()
d. filter_input
Answer: filter_var_array()


Que. Which of the following is/are an external data?
1. Cookies
2. Input data from a form
3. Server Variables
4. Web services data
a. Only 2
b. None of the mentioned
c. 2 and 3
d. All of the mentioned
Answer: All of the mentioned


Que. Which one of the following does not describe a validating filter?
a. Are used to validate user input
b. Returns the expected type on success or FALSE on failure
c. Are used to allow or disallow specified characters in a string
d. Strict format rules


Are used to allow or disallow specified characters in a string


Comments