Re: The || Operator
| From: | Carl P. Corliss | Date: | Sun, 25 May 2003 02:20:31 +0000 |
| Subject: | Re: The || Operator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148887@lists.php.net to get a copy of this message | ||
On Saturday 24 May 2003 11:18 am, zavaboy wrote:
> $you = "some";
> if ($you == ("few" || "some" || "one")) {
> echo "yes";
> }else{
> echo "no";
> }
>
> How can I make it print out "yes" if $you is equal to "few",
> "some", or
> "one"?
>
>
>
in addition to the other suggestions, you could also do something like so:
// this is case insensitive
if (eregi('^(few|some|one)$',$status)) {
echo "yes";
} else {
echo "no";
}
--
Carl P. Corliss
System Administrator / Developer
Xaraya Web Application Framework Project
www.xaraya.com