note 43111 added to language.operators
| From: | php-general at lists dot php dot net | Date: | Wed, 09 Jun 2004 21:58:07 +0000 |
| Subject: | note 43111 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70624@lists.php.net to get a copy of this message | ||
of course this should be clear, but i think it has to be mentioned espacially:
AND is not the same like &&
for example:
<?php $a && $b || $c; ?>
is not the same like
<?php $a AND $b || $c; ?>
the first thing is
(a and b) or c
the second
a and (b or c)
'cause || has got a higher priority than and, but less than &&
of course, using always [ && and || ] or [ AND and OR ] would be okay, but than you should
at least respect the following:
<?php $a = $b && $c; ?>
<?php $a = $b AND $c; ?>
the first code will set $a to the result of the comparison $b with $c, both have to be true, while
the second code line will set $a like $b and THAN - after that - compare the success of this with
the value of $c
maybe usefull for some tricky coding and helpfull to prevent bugs :D
greetz, Warhog
----
Manual Page -- http://www.php.net/manual/en/language.operators.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43111
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43111&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43111&report=yes
Search -- http://master.php.net/manage/user-notes.php