RE: [PHP] PHP and Ranges
| From: | ..s.c.o.t.t.. | Date: | Fri, 20 Apr 2001 03:40:39 +0000 |
| Subject: | RE: [PHP] PHP and Ranges | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49458@lists.php.net to get a copy of this message | ||
this works:
$r_start = 0;
$r_end = 65535;
$a = array('12', '198', 'b');
while ( list($k,$v) = each($a) ) {
if ( ($v > $r_start) && ($v < $r_end) ) {
print "[$v] OK<BR>\n";
}
else {
print "[$v] NOPE<BR>\n";
}
}
> -----Original Message-----
> From: Jason Caldwell [mailto:jason@thinkingman.org]
> Subject: [PHP] PHP and Ranges
>
>
> 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