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 ranges.
But I don't know of it's specific existance.
--
Plutarck
Should be working on something...
...but forgot what it was.
""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message
9bnos3$flm$[EMAIL PROTECTED]">news:9bnos3$flm$[EMAIL PROTECTED]...
> 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;
> }
>
> print($valid . "\n");
> }
>
> output should look like:
> 1
> 1
> 0
>
> how is this accomplished in PHP?
>
> thanks.
> jason
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]