Php comparison operator and logical operation symbol

Source: Internet
Author: User
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. 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.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.