Re: Re: If...Or...Else
| From: | Stan F | Date: | Sat, 24 Jul 2004 17:23:13 +0000 |
| Subject: | Re: Re: If...Or...Else | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191753@lists.php.net to get a copy of this message | ||
Operations OR and || have different execution priorities. I'd prefer "||" as
it's "more important" so not so many parentheses needed to ensure the order
of interpretation is exactly what u need.
----- Original Message -----
From: "Tularis" <tularis@php.net>
To: <php-general@lists.php.net>
Sent: Saturday, July 24, 2004 6:57 PM
Subject: [PHP] Re: If...Or...Else
> if(a OR b) {
> do something
> } else {
> do something else
> }
>
> or
>
> if(a || b) {
> do something
> } else {
> do something else
> }
>
> is enough :)
>
> Robb Kerr wrote:
> > From time to time I need an If statement that includes an Or
condition...
> >
> > <?php
> > if ((condition1 == TRUE) OR (condition2 == TRUE)) {
> > do something;
> > } esle {
> > do something else;
> > }
> > ?>
> >
> > What's the correct syntax for the If line?
> >
> > Thanx
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>