Problem with variables in PHP

Source: Internet
Author: User
# $ABC = "abc";
$def;
#var_dump (Isset ($ABC));
Var_dump (Empty ($def));
Var_dump (FALSE);
Var_dump (Empty (")");
Var_dump (Isset ($def));
Var_dump (Is_null ($def));
#var_dump (Isset ($def));
#1. PHP Data variables have declarations and definitions that are similar to variables in C/
#php中没有声明, only undefined and defined
#2. What is the definition of a PHP variable? is $def; or $ABC = "abc";?
# in PHP the definition of variables is to write variables directly to the variable assignment, that is $ABC = "abc"; This is called variable definition.
# if $def, what will it show? Let's do an experiment. Var_dump ($DEF);
#输出:
#Notice: Undefined variable:def in C:\Users\lsqbupt\Desktop\abcdefg.php on line 9
#NULL
# $def; This is called a variable not defined

#让我们再做一个实验
# if $def = null; Var_dump ($DEF);
# will output NULL, and will not have notice

#
#3. Isset () Is_null () empty () and the variables themselves as a judgment when if ($ABC) or if ($def), what is the difference between these functions?
#4. What is NULL? Is it case sensitive?
#NULL Empty Type
#null大小写不敏感, the null type has only one value, indicating that a variable has no value, and the following three case variables are considered null
#1. Assigned value is NULL
#2. Has not been assigned a value
#3. be unset ();
The function of the #is_null () function is literally visible, quite simple.
#isset () and Is_null () are a pair
#isset () function: When {undefined, such as $def} and {The variable itself is null, such as $def = NULL;} returns false and neither is notice, the other returns True
#empty () Function: When "," ", 0, ' 0 '," 0 ", NULL, False, array (), undefined variable, all return to True
The #is_null () function, when {undefined, such as $def} and {The variable itself is null, such as $def = NULL;} returns True when the other returns false
The #is_null () function pairs {Undefined, such as $def} will have notice, and the {variable itself is null such as $def = null;} But there is no notice {I found this function and Isset () is a pair of AH}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above introduces the variables in PHP, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

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