Today, using the empty () function to determine if a variable is null is the discovery hint Note:empty () only checks variables as anything else would result in a parse error. In other words, the following would not Work:empty (trim ($name)). Wrong, after a whole day to find the problem.
When you use empty to check the results returned by a function, a fatal error is reported as follows:
Fatal Error:can ' t use function return value in the write context in: ..... .....
For example:
echo Empty (YourFunction (xx, oo));
To the PHP manual, where the empty function describes the following text:
Note:empty () Only checks variables as anything else would result in a parse error. In other words, the following would not Work:empty (trim ($name)).
Empty () detects only variables and detects anything that is non-variable will result in parsing errors!
Therefore, we can not take empty to directly detect the value returned by the function, we need to first assign the return value of the function to a variable, and then to use empty to detect the variable.
So, we can write the following form:
$return = YourFunction (xx, oo);
echo empty (return);
http://www.bkjia.com/PHPjc/633171.html www.bkjia.com true http://www.bkjia.com/PHPjc/633171.html techarticle today, using the empty () function to determine if a variable is null is the discovery hint Note:empty () only checks variables as anything else would result in a parse error. In other words, the foll ...