PHP null Null Value

Source: Internet
Author: User

NULL (null): a special data type in PHP, indicating a null value, that is, no value is set for this variable. null (null) is case-insensitive. null and null are the same.
NULL values can be assigned in three situations: no value is assigned, null is assigned, and the variable is processed by the unset () function.(Source: PhP from entry to proficiency, p47.

The instance is as follows::
<? PHP
Echo "the value of variable ($ string1) is null ";
$ String = NULL; // $ string1 is assigned a null value.
$ String3 = "str"; // $ string3 is assigned Str
If (is_null ($ strig1 = NULL) {// judge whether $ string1 is null
Echo 'string = null ';
}
Echo '<p> ';
Echo 'variable ($ string2) not assigned ';
If (is_null ($ string2 = NULL) {// judge whether $ string1 is null
Echo 'string = null ';
}
Echo '<p> ';
Echo 'variable released by unset () ($ string3 ):';
Unset ($ string3 );
If (is_null ($ string3 = NULL) {// judge whether $ string1 is null
Echo 'string = null ';
}
?>

Browser processing result:
The variable ($ string1) is directly assigned nullstring = NULL.
Variable ($ string2) not assigned string = NULL
Variable released by unset () ($ string3): String = NULL

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.