开发者

How to find a numeric value within a range in php

开发者 https://www.devze.com 2023-02-11 08:12 出处:网络
How can I find a 开发者_运维问答value let: 745 is within a range of 0 to 1000 using php?(0 <= $value && $value <= 1000)

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

精彩评论

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

关注公众号