Re: Re: If...Or...Else
| From: | Skippy | Date: | Sun, 25 Jul 2004 20:15:41 +0000 |
| Subject: | Re: Re: If...Or...Else | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191838@lists.php.net to get a copy of this message | ||
On Sun, 25 Jul 2004 15:42:42 +0200 "rush" <pipa@rush.avalon.hr> wrote:
> "Jason Davidson" <jason.davidson@gmail.com> wrote in message
> news:6c925ae204072412386fa9cefa@mail.gmail.com...
> > ah right.. :)
> > Jason
>
> OR has a very low priority , and right argument is not evaluated if left
> one is true.
Same thing happens with ||, FWIW. The if condition is not evaluated further
than it needs to be in either case.
> In other words OR is here so that you could in pre exception
> handling days easily write something like this:
>
> mysql_query(...) OR die;
This also works with ||:
mysql_query(...) || die;
I just wanted to make things clear, because the way you said it above may
lead to misinterpretations, such as believing that || makes all the elements
in a condition evaluate even if not necessary, which is not true.
So OR simply has lower precedence than ||, but no other hidden properties.
Any idea why the need to have two logical operators with the same meaning BUT
different precedences? I dig the need to put in OR as an alias, but why
confuse people with the precedence issue? One would tend to think || and OR
are perfectly interchangeable.
--
Skippy - Romanian Web Developers - http://ROWD.ORG