Jump to content


Photo

Difference between && and AND


  • Please log in to reply
1 reply to this topic

#1 atitthaker

atitthaker
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts
  • LocationBanglore, India

Posted 08 August 2006 - 10:24 AM

I know the diff that AND is loosely bound and && is tightly bound but what is the working diff of the same??? If poss plz give example...
Beginner with PHP and need help

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 08 August 2006 - 10:35 AM

Its all to do with precedence, && and || have a higher precedence than AND and OR. I see it like this...
<?php
$a && $b OR $c; //Would be equal to ($a && $b) || $c;
$a AND $b || $c; //Would be equal to $a && ($b || $c);
$a && $b || $c; //Would be equal to ($a && $b) || $c;
?>
I think it's easier just to use parenthesise...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users