"||" The difference between an "or" in an expression

Source: Internet
Author: User
Example 1
Code:
$a = False | | True
Var_dump ($a);
Output Result: True
Description: "| |" Or, the priority is higher than the "=" equals sign, so the false| is calculated first | True for this expression, the result of the expression is true, and then the result of true is assigned to the variable $ A, and then var_dump ($a) prints the result to true

Example 2
Code:
$b = False or true;
Var_dump ($b);
Output result: false;
Note: "or" or, in this expression, the priority is lower than the "=" equal sign, so the rule is calculated to calculate the $b = False expression First, when the Var_dump ($b) printing, the result is false

"||" The difference between an "or" in an expression

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.