Check if a number is within a range
W
W 2017-11-20 16:17:03
0
2
1165
<?php
        $int = 12;
        $min = 1;
        $max = 100;


        if(filter_var($int,'FILTER_VALIDATE_INT', array("options"=>array("min_range"=>$min,"max_range"=>$max))) === false){
            echo ("The number is valid");
        }else{
            echo ("The number is not valid");
        }               
    ?>


W
W

愿能多结交志同道合的基友!哈哈哈。。。。。

reply all(2)
电动小老虎



First $arr = range(1,100);

foreach($arr as $k $v)

if ($ int === $ v)

{

## Echo ' #} Else {


Echo 'Not';

##}


# Does it work?

W

Just remove the quotes from 'FILTER_VALIDATE_INT'

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template