Re: PHP and Ranges

From: Date: Thu, 19 Apr 2001 22:32:03 +0000
Subject: Re: PHP and Ranges
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49462@lists.php.net to get a copy of this message
I can do it, it aint pretty though <?php for($c = 0; $c < 65535; $c++) $range[] = $c; $a[0] = '12'; $a[1] = '198'; $a[2] = 'B'; foreach($a as $pos => $val) if (in_array($val, $range)) echo "True <br>"; else echo "False <br>"; ?> works, just aint pretty. -- Chris Lee lee@mediawaveonline.com ""Jason Caldwell"" <jason@thinkingman.org> wrote in message news:9bnos3$flm$1@toye.p.sourceforge.net... 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49462) next »