Reputation: 7194
How can I find a value let: 745 is within a range of 0 to 1000 using php?
Upvotes: 3
Views: 2609
Reputation: 20878
Use a condition
<?php
$val = 745;
if ($val >= 0 && $val <= 1000)
{
// Ok
}
else
{
// Not ok
}
Upvotes: 1
Reputation: 108800
How about using <=
and >=
?
$x=745;
$inrange=(0<=$x)&&($x<=1000)
Upvotes: 1