PHP

PHP

PHP Filter has 8 Questions
Which of the following is/are an external data? i) Cookies ii) Input data from a form iii) Server Variables iv) Web services data

Only ii)
ii) and iii)
None of the mentioned
All of the mentioned
How many types of filtering are present in PHP?

3
2
4
None
Which one of the following filter is used to filter several variables with the same or different filters?

filter_var_array()
filter_var()
filter_input
filter_input_array
What will be the output of the following PHP code?
  1.     <?php
  2.     $num = "123";
  3.     if (!filter_var($num, FILTER_VALIDATE_INT))
  4.         echo("Integer is not valid");
  5.     else
  6.         echo("Integer is valid");
  7.     ?>

No output is returned
Integer is not valid
Integer is valid
Error
Which one of the following does not describe a validating filter?

Are used to allow or disallow specified characters in a string
Are used to validate user input
Strict format rules
Returns the expected type on success or FALSE on failure
What will be the output of the following PHP code?
  1.     <?php
  2.     $var=300;
  3.     $int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));
  4.     if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))
  5.         echo("Integer is not valid");
  6.     else
  7.         echo("Integer is valid");
  8.     ?>

No output is returned
Integer is not valid
Integer is valid
Error
Which one of the following filter checks if variable of specified type exists?

filter_has_var
filter_var
filter_id
filter_var_array
What will be the output of the following PHP code?
  1.     <?php
  2.     function convertSpace($string)
  3.     {
  4.         return str_replace("_", " ", $string);
  5.     }
  6.     $string = "Peter_is_a_great_guy!";
  7.     echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
  8.     ?>

Peter_is_a_great_guy!
Peterisagreatguy!
Peter is a great guy!
Error