Ask master, code question

Source: Internet
Author: User
Please ask master the following code:

$p = 10;
$q = 8;
if ($p ++>17 or $q ++>7)//if (false or True)
{
echo ' truth ';
}else
{echo ' $p = '. $p. ' $q = '. $q;}

Why is the result of running: Truth? Instead of $p=11 $q = 7? I remember $ee=false or true;var_dump ($ee); its value should be false rather than true. Why is this?


Reply to discussion (solution)

is correct, or satisfies a condition is true, and $ee= (false or True) is true, the front is = higher than or operation level

You test the next few of them.
$ee =false or True
$ee ==false or True
$ee = (false or True)

It's all positive, huh?

if ($p ++>17 or $q ++>7)
Equivalent

if ($p >17 or $q >7)
{
}

$p + +; $q + +;

Add 1 after using the variable

You can try the first floor on the second floor method, all are positive solutions.

or replace it with and that's what you said.

Or one is really true
and a fake fake

if ($p ++>17 or $q ++>7) with $ee=false or true; Why? $ee =false or true; How is it calculated?

  • 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.