Today is about the use of the empty function, and what the difference between, and use it to manipulate the array is not return the normal value, the need for friends can refer to.
The code is as follows |
Copy Code |
$array 1=array (); Print_r ($array 1); if (Empty ($array 1)) { Echo ' is an empty array (an empty array) for empty (); } else{ Echo ' is a non-empty array (an Noempty array) for empty (); } ?> displaying results: ###################### Array ( ) For empty () is an empty array
|
###############################
The code is as follows |
Copy Code |
$array 1=array (); $array 1[]= '; Print_r ($array 1); if (Empty ($array 1)) { Echo ' is an empty array (an empty array) for empty (); } else{ Echo ' is a non-empty array (an Noempty array) for empty (); } ?> displaying results: ###################### Array ( [0] = = ) is a non-empty array (an Noempty array) for empty () ############################### |
This is not an empty array, because it has an element that is a null character (""), to be aware of the difference from the null character ("" (An empty string));
is actually
Empty ($x) equals!isset ($x) | | ! $x
!empty ($x) equals isset ($x) && $x
About the empty function syntax
Empty--Check if a variable is null
Describe
bool Empty (mixed Var)
If Var is a non-null or nonzero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, Array (), Var $var; and objects that do not have any properties will be considered empty and return TRUE if Var is empty.
http://www.bkjia.com/PHPjc/632256.html www.bkjia.com true http://www.bkjia.com/PHPjc/632256.html techarticle today is about the use of the empty function, and what the difference between, and use it to manipulate the array is not return the normal value, the need for friends can refer to. Code ...