Home  >  Article  >  Backend Development  >  Operator precedence - PHP operator precedence

Operator precedence - PHP operator precedence

WBOY
WBOYOriginal
2016-07-25 08:46:211063browse

Operator priority - PHP operator priority, friends in need can refer to it.


PHP operator precedence
Combined direction Operator Additional information
Non-binding clone new clone and new
Left [ array()
Non-binding ++ -- Increment/Decrease Operator
Non-binding ~ - (int) (float) (string) (array) (object) (bool) @ Type
Non-binding instanceof Type
Right combination ! Logical operators
Left * / % Arithmetic operators
Left + - . Arithmetic operators and string operators
Left > bit operators
Non-binding >= Comparison operators
Non-binding == != === !== Comparison operators
Left & bit operators and references
Left ^ bit operators
Left | bit operators
Left && Logical operators
Left || Logical operators
Left ? : Ternary operator
right = += -= *= /= .= %= &= |= ^= >= Assignment operator
Left and Logical operators
Left xor Logical operators
Left or Logical operators
Left , Used in many places
This table gives Python’s operator precedence (lowest to highest).
From lowest priority (most loosely coupled) to highest priority (most tightly coupled).
This means that within an expression, Python will first evaluate operators listed lower in the table, and then evaluate operators listed higher in the table.

Operator


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn