Operator Precedence is an important point of knowledge that a programmer must understand and hold, let's take a look at the PHP operator precedence article.
Today in Lao Wang's technical manual saw a problem:
The code is as follows
The two priorities are the same, and the comparison (comparision) and Assignment (Assignment) operations are slightly different. The comparison operator has a, =, and so on, the assignment operator has =, + =, *=, and so on.
The comparison
The operator precedence specifies how tightly the two expressions are bound. For example, the result of the expression 1 + 5 * 3 is that it is because multiplication sign ("*") has a higher priority than the plus sign ("+"). You can use
Today in Lao Wang's technical handbook see a problem:
The code is as follows
Copy Code
What is the output?
This question may seem simple at first glance, but it is not easy to scrutinize it,
If the Boolean
The operator precedence specifies how tightly the two expressions are bound. For example, the result of the expression 1 + 5 * 3 is that It is because multiplication sign ("*") has a higher priority than the plus sign ("+"). You can use
When we talked about the PHP logical operators, we mentioned the precedence of the PHP operators, the so-called operator precedence, which is the calculation of which operation Mr. Foo in the expression, which is calculated as if the result of the
Arithmetic operators
Operator name Result
$a + $b addition $a and $b and
$a-the difference between $b subtraction $a and $b
$a * $b multiplication $a and the product of $b
$a/$b division $a divided by the quotient of the $b
$a% $b modulo $a divided
Arithmetic operators
Operator name Result
$a + $b addition $a and $b and
$a-the difference between $b subtraction $a and $b
$a * $b multiplication $a and the product of $b
$a/$b division $a divided by the quotient of the $b
$a% $b modulo $a divided
Arithmetic operators
Operator name Result
$a + $b addition $a and $b and
$a-$b subtraction $a and $b difference
$a * $b multiplication of $a and $b
$a/$b division $a divided by $b quotient
$a% $b modulo $a divided by the remainder of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.