One way is:
$min = 0;
$max = 65535;
if ($var >= $min && $var <= $max)
{
...
}
Though I haven't heard of a range comparison, it would be nice if one
existed...especially if it could be something like "0-4, 6-8, 9-21", and it
would return true of the value was within any of the specified ran
I can do it, it aint pretty though
$val)
if (in_array($val, $range))
echo "True ";
else
echo "False ";
?>
works, just aint pretty.
--
Chris Lee
[EMAIL PROTECTED]
""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9bnos3$flm$[EMAIL PROTECTED]">news:9bnos3$flm$[EMAIL PR
print "[$v] NOPE\n";
}
}
> -Original Message-----
> From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
> Subject: [PHP] PHP and Ranges
>
>
> is there a way to compare a value to a preset range.
>
> for example;
>
> $preset_ range = [0...65535]
&g
is there a way to compare a value to a preset range.
for example;
$preset_ range = [0...65535]
$a[0] = "12";
$a[1] = "198";
$a[2] = "B";
$ac = count($a);
for($x=0; $x < $ac; $x++)
{
if($a[$x] != $preset_range)
{
$valid = 0;
}
else
{
valid = 1;
}
pr
4 matches
Mail list logo