In recent projects, a field is encountered that is "enabled" if the value is 0,1 when the query is not written
if isset ($args _array[' USEFLG ']) &&! Empty ($args _array[' USEFLG '])) {..... }
So I did not find the time for 0, think about it, should be 0 is considered empty. This should be the case:
if isset ($args _arrayin_array($args _arrayarray(0,1))) {... }
Read the PHP manual, Memo:
If var
the value is non-null or nonzero, empty () returns FALSE
. In other words,"",0,"0",,, NULL
FALSE
Array (),var $var; and objects that do not have any properties are considered empty, and if they are var
empty, they are TRUE
returned.
<? PHP $var = 0; // The result is true because the $var is empty if (empty($var)) { echo ' $var is either 0 or not set at all ';} // The result is false because the $var has been set if (! isset ($var)) { echo ' $var is not set at all ';}? >
The following things is considered to beEmpty: "" (AnEmpty string)0 (0 asAninteger)0.0 (0 asAfloat)"0" (0 asAstring)NULLFALSEArray() (AnEmpty Array)var $var; (a variable declared, but without a value in aclass)
Manual See: http://php.net/manual/zh/function.empty.php
PHP empty function to determine 0 return TRUE or false?