How are 'and' and && different?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
SmokyBarnable
Forum Contributor
Posts: 105
Joined: Wed Nov 01, 2006 5:44 pm

How are 'and' and && different?

Post by SmokyBarnable »

What exactly is the difference between 'and' and '&&'?

Thanks.
brendandonhue
Forum Commoner
Posts: 71
Joined: Mon Sep 25, 2006 3:21 pm

Post by brendandonhue »

They have different precedence in the order of operations.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

They both are logical operators and are same. Just like "OR" and "||" are same.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

and the winner is....... " brendandonhueeeeee" :)
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

They are not the same:
brendandonhue wrote:They have different precedence in the order of operations.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

What is the difference then ? I didn't find any difference.
Oren wrote:They are not the same:
brendandonhue wrote:They have different precedence in the order of operations.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

dibyendrah wrote:What is the difference then ? I didn't find any difference.
Oren wrote:They are not the same:
brendandonhue wrote:They have different precedence in the order of operations.
Read this for an explanation of Operator Precedence

http://uk2.php.net/manual/en/language.o ... precedence
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

okay, both are logical operators but having difference precedence only.
Post Reply