Re: Can PHP do an "IF" for 5-20

From: Date: Fri, 15 Dec 2000 00:14:04 +0000
Subject: Re: Can PHP do an "IF" for 5-20
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30417@lists.php.net to get a copy of this message
Either way should work just fine. --Joe On Fri, Dec 15, 2000 at 11:08:57AM +1100, Mark Green wrote: > > if ($number >= 4 && $number <= 20) { > DO SOMETHING > > } > > or to do it dynamically > $min = 4; > $max = 20; > > if ($number >= $min && $number <= $max) { > DO SOMETHING > > } > > > Cheers, > > mark > > -----Original Message----- > From: Robert Abbate [mailto:cogea@ectisp.net] > Sent: Friday, 15 December 2000 4:18 AM > To: php-general@lists.php.net > Subject: [PHP] Can PHP do an "IF" for 5-20 > > > Is there a way to do an "if" statement to include a series of numbers > instead of matching just ONE? I know that you can use the "switch" operator, > but I have a great multitude of numbers. Is "switch" the only answer? > > Example: > > if ($number == '5 through 20') > { > do something > } > > Thanks > -- > Robert > > -- > 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 --- Joe Stump PHP Programmer www.Care2.com

« previous php.general (#30417) next »