An operator is a symbol that tells the compiler to execute specific arithmetic or logical operations. It usually forms an expression together with the operands. we often see that it participates in mathematical or logical operations. PHP also contains many operators. This article details...
An operator is a symbol that tells the compiler to execute specific arithmetic or logical operations. It usually forms an expression together with the operands. we often see that it participates in mathematical or logical operations. PHP also contains many operators. This article details the important comparison operators.
Function standard_array_compare ($ op1, $ op2) {if (count ($ op1) <count ($ op2) {// small return-1 array with fewer members; // $ op1 <$ op2} elseif (count ($ op1)> count ($ op2) {return 1; // $ op1> $ op2} foreach ($ op1 as $ key => $ val) {if (! Array_key_exists ($ key, $ op2) {return null;} else if ($ val <$ op2 [$ key]) {return-1 ;} elseif ($ val> $ op2 [$ key]) {return 1 ;}} return 0; // $ op1 ==$ op2}
Comparison operators:
Expression (expr1 )? (Expr2): (expr3) when the expression expr1 is TRUE, the value is expr2, and when the expression expr1 is FALSE, the value is expr3.
The above is a detailed explanation of comparison operators and logical operators in PHP. For more information, see other related articles in the first PHP community!