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");
?>
A. No output is returned
B. Integer is not valid
C. Integer is valid
D. Error
Answer: Option B
Solution(By Examveda Team)
Since the integer is “300” it is not in the specified range, and the output of the code above will be: “Integer is not valid”.Related Questions on PHP Filter
A. Only 2
B. 2 and 3
C. None of the mentioned
D. All of the mentioned
A. filter_var_array()
B. filter_var()
C. filter_input
D. filter_input_array
A. No output is returned
B. Integer is not valid
C. Integer is valid
D. Error
Join The Discussion