For a php operator priority problem, first look at an operator priority table OperatorPrecedence (operator priority) to reference AssociativityOperatorsAdditionalInformationnon-associativeclonenewcloneandnewleft [array () non-associative ++ -- a php operator priority problem.
First look at an operator priority table
Operator Precedence (Operator priority)
Reference
AssociativityOperatorsAdditional Information
Non-associativeclone newclone and new
Left [array ()
Non-associative ++ -- increment/decrement
Right ~ -(Int) (float) (string) (array) (object) (bool) @ types
Non-associativeinstanceoftypes
Right! Logical
Left */% arithmetic
Left +-. arithmetic and string
Left <> bitwise
Non-associative <<=>=<> comparison
Non-associative =! ===! = Comparison
Left & bitwise and references
Left ^ bitwise
Left | bitwise
Left & logical
Left | logical
Left? : Ternary
Right = + =-= * =/=. = % = & =|==<<=>==> assignment
Leftandlogical
Leftxorlogical
Leftorlogical
Left, sort uses
Reference
& Prior to = prior to and
However
Reference
$ A = 100 & $ B = 200
The order according to the operator priority rules should be
Reference
$ A = (100 & $ B) = 200)
But there are rules in php,
Reference
Note: Although = has a lower precedence than most other operators, PHP will still allow expressions similar to the following: if (! $ A = foo (), in which case the return value of foo () is put into $.
So the actual effect is
Reference
($ A = 100) & ($ B = 200)
It is equivalent to turning & into and
In addition, an example of the reference of laruence
Reference
Finally, by the way, PHP also defines T_LOGICAL_AND (and) and T_LOGICAL_OR (or) for T_BOOLEAN_AND. the priority of these two values is lower than the equal sign, so there will be, the following are typical examples of PHP tutorials:
$ Result = mysql_query (*) or die (mysql_error ());