The difference between null,0,,false in PHP updatedata false javascript:false Async Fals

Source: Internet
Author: User
The empty () function is used to determine whether a string is empty

As long as the variable is 0,null, ", False,empty () is judged to be true.

    $num 1= ';    $num 2=0;    echo $num 1== $num 2;    Echo '
'; echo $num 1=== $num 2? ' 1 ': ' 0 ';

The result is:


The reason is that in PHP variables are stored in the structure of the C language, empty strings and null,false are stored with a value of 0, where the struct has a zend_uchartype, such a member variable, which is used to hold the type of the variable, and the type of the empty string is a string, The type of NULL is Null,false is Boolean. the = = = Operator Not only compares values, but also compares types.

Judging the empty string and 0 can do this:

    $num 1= ';    $num 2=0;    if (Empty ($num 1) && $num 1=== ") {    echo" true ";    }    if (Empty ($num 2) && $num 2===0) {    echo ' true ';    }
The result is:


The above describes the PHP null,0,,false differences, including the false,null aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    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.