开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜