Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any advantage to using AND and OR over && and || in PHP?

In the Kohana code conventions it states that using && and || is "incorrect":

alt text

Is there any advantage to using AND and OR other than clarity?

like image 339
Edward Tanguay Avatar asked Dec 15 '10 05:12

Edward Tanguay


People also ask

What are the advantages in using the prepositions?

While prepositions are limited in number, they are important because they act as vital markers to the structure of a sentence; they mark special relationships between persons, objects, and locations.

What are examples of advantages?

The definition of advantage means anything that provides a more favorable position, greater opportunity or a favorable outcome. An example of an advantage is when a football team plays a game in their home stadium. The first point scored in tennis after deuce. To provide (someone) with an advantage, to give an edge to.

Are there more advantages of or to?

"Advantage of" is used to explain the benefits of something which is in support. But "advantage to" is used to explain the benefits against something.


1 Answers

The truth tables for the operators are the same, the only difference is precedence:

http://php.net/manual/en/language.operators.logical.php

http://www.php.net/manual/en/language.operators.precedence.php

like image 87
Dan Grossman Avatar answered Sep 19 '22 02:09

Dan Grossman