PHP development, when you use empty to check the results returned by a function will be error: Fatal Error:can ' t using function return value in write context
For example, the following code:
Copy the Code code as follows:
echo Empty (strlen (' Test '));
Go to the PHP manual to see where the empty function describes the following text:
Copy the Code code as follows: 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)).
It concludes that empty () only detects variables and detects anything that is non-variable will result in parsing errors!
Therefore, we cannot take empty to directly detect the value returned by the function, the solution of the above example is as follows:
Copy the Code code as follows:
$length = strlen (' test ');
echo Empty ($length);
http://www.bkjia.com/PHPjc/736792.html www.bkjia.com true http://www.bkjia.com/PHPjc/736792.html techarticle PHP Development, when you use empty to check the results returned by a function will be error: Fatal Error:can ' t uses function return value in write context such as the following code: Copy code code ...