: This article describes the variables in PHP. For more information about PHP tutorials, see. # $ 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. is there any declaration and definition of a variable similar to C/C ++ in php Data variables?
# Php is not declared, only undefined and defined
#2. what is the definition of php variables? Is it $ def; or $ abc = "abc ";?
# In php, the variable definition is to assign a value directly to the variable when writing the variable, that is, $ abc = "abc"; this is called the variable definition.
# What will be displayed if $ def is used? Make an experiment. var_dump ($ def );
# Output:
# Notice: Undefined variable: def in C: \ Users \ lsqbupt \ Desktop \ abcdefg. php on line 9
# NULL
# $ Def; this is called variable undefined
# Let's create another experiment.
# Suppose $ def = null; var_dump ($ def );
# NULL will be output without Notice
#
#3. What are the differences between the isset () is_null () empty () and if ($ abc) or if ($ def) functions when the variable itself is used as the judgment?
#4. what is null? Is it case sensitive?
# NULL type
# Null is case insensitive. The NULL type has only one value, indicating that one variable has no value. The following three variables are considered NULL.
#1. The value is NULL.
#2. not assigned
#3. unset ();
# The functions of the is_null () function can be viewed literally, which is quite simple.
# Isset () and is_null () are a pair
# Isset () function: When {undefined, for example, $ def} and {variable itself are NULL, for example, $ def = null;}, false is returned and no notice is returned. others return true.
# Empty () function: when ''," ", 0, '0'," 0 ", null, false, array (), undefined variables, true is returned.
# Is_null () function. if {undefined, for example, $ def} and {variable itself is NULL, for example, $ def = null;}, true is returned, and false is returned.
# Is_null () function has {undefined, for example, $ def} has notice, and the {variable itself is NULL, for example, $ def = null ;} but there is no notice {I found this function is a pair with isset}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the variables in PHP, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.