1. Which of the following is/are an external data?
1. Cookies
2. Input data from a form
3. Server Variables
4. Web services data
1. Cookies
2. Input data from a form
3. Server Variables
4. Web services data
2. How many types of filtering are present in PHP?
3. Which one of the following filter is used to filter several variables with the same or different filters?
4. 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");
?>
<?php
$num = "123";
if (!filter_var($num, FILTER_VALIDATE_INT))
echo("Integer is not valid");
else
echo("Integer is valid");
?>
5. Which one of the following does not describe a validating filter?
6. What will be the output of the following PHP code?
<?php
$var=300;
$int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));
if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))
echo("Integer is not valid");
else
echo("Integer is valid");
?>
<?php
$var=300;
$int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));
if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))
echo("Integer is not valid");
else
echo("Integer is valid");
?>
7. Which one of the following filter checks if variable of specified type exists?
8. What will be the output of the following PHP code?
<?php
$value = 'car';
$result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
?>
<?php
$value = 'car';
$result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
?>
9. What will be the output of the following PHP code?
<?php
function convertSpace($string)
{
return str_replace("_", " ", $string);
}
$string = "Peter_is_a_great_guy!";
echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
?>
<?php
function convertSpace($string)
{
return str_replace("_", " ", $string);
}
$string = "Peter_is_a_great_guy!";
echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
?>