How to find a numeric value within a range in php
How can I find a 开发者_运维问答value let: 745 is within a range of 0 to 1000 using php?
(0 <= $value && $value <= 1000)
How about using <=
and >=
?
$x=745;
$inrange=(0<=$x)&&($x<=1000)
Use a condition
<?php
$val = 745;
if ($val >= 0 && $val <= 1000)
{
// Ok
}
else
{
// Not ok
}
精彩评论