array ("min"=>0, "max"=>256));if (!filter_var($n, FILTER_VALIDATE_INT,"> What will be the output of the following PHP code?<?php$n=256;$int_opt

Home » PHP » PHP Filters Advanced » Question
  1. What will be the output of the following PHP code?
    <?php
    $n=256;
    $int_opt = array("opt"=>array ("min"=>0, "max"=>256));
    if (!filter_var($n, FILTER_VALIDATE_INT, $int_opt))
    echo("Given Integer is not valid");
    else
    echo("Given Integer is valid");
    ?>
    1. Given Integer is valid
    2. Error
    3. Given Integer is not valid
    4. Nothing
    5. None of these
Correct Option: A

Since the integer is “256” it is in the specified range, and the output of the code above will be: “Given Integer is valid”.



Your comments will be displayed only after manual approval.