Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Use php! What does the = = operator mean?
Use php! What does the = = operator mean?
"With PHP? : "refers to the three-eye symbol.

Tripartite operator, also known as conditional operator, is an important part of computer language. It is the only operator with three operands, so it is sometimes called ternary operator. Usually, the combination of three operators is the right boundary.

The three-eye operator provides a simple way to express a simple if-else statement. Operator with a question mark (? ) and colon (:): expression? Expression: expression; A statement is called a conditional expression and consists of three sub-expressions, with a question mark? And colon: separate.

The part before the question mark in the conditional expression is the condition to be tested. This is like an expression in parentheses in an if statement. If the condition is true, execute? A statement between. And:; Otherwise, perform the following section. If you think it is helpful, you can put parentheses around the subexpression.

Extended data:

Operation rules of & ltphp & gt function

1, for conditional expression b? X: y, calculate condition b first, and then judge. If the value of b is true, the value of x is calculated, and the result of the operation is the value of x; Otherwise, calculate the value of y, and the result of the operation is the value of y.

2. Conditional expressions will never evaluate x and y at the same time. Conditional operators are right-associative, that is, grouped from right to left. Like one? B: C? D: e will be executed as? B: (C → D: E).

3. it can be understood as: conditions? Result 1: Result 2, in it? This number is a format requirement. It can also be understood as whether the condition holds, and the condition holds as result 1, otherwise it is result 2.

Baidu Encyclopedia-Tripartite Operator