On Thu, 2007-06-14 at 12:12 +0200, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Wed, 2007-06-13 at 13:57 -0400, [EMAIL PROTECTED] wrote:
> >> double pipes constitutes an "OR" operation. You can use the keyword OR
> >> as well. Also, && and AND are the same as well.
> >>
> >> http://us.php.net/manual/en/language.operators.logical.php
> >
> > They aren't exactly the same. Make sure and read the order of precedence
> > note. The following, for example, are not equivalent:
>
> I knew that they we're not exactly the same due to order of precedence, but
> I ran Robbert's code snippet and found that my assumptions about the outcome
> incorrect!
^^^^^^^
That's Robert :)
> my assumption was that '=' had lower precedence that 'and' ... somehow that
> felt right,
> obviously I was wrong.
>
> it took me a few seconds to see the error of my ways :-) maybe there are other
> that are confused ... maybe the output of following little snippet might help
> to clarify:
>
> <?php
>
> $true = true;
> $false = false;
>
> $test1 = $true && $false;
> $test5 = ($test2 = $true and $false);
> $test3 = ($true && $false);
> $test4 = ($true and $false);
>
> var_dump($test1, $test2, $test3, $test4, $test5);
>
> ?>
>
> thanks to Robbert for the brainteaser ;-)
^^^^^^^
I'm not sure if you're confused, pulling my leg, or somehow capable of
slurring a 'b' :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php