The error message "Fatalerror: Can & amp; rsquo; tusefunctionreturnvalueinwritecontext" is displayed in the empty function today. This function is strange.
The error message "Fatal error: Can't use function return value in write context" is displayed in the empty function today. I think this function has been used for a long time. why, error message: Fatal error: Can't use function return value in write context in empty. php on line 5, my code is written as follows:
- $ Str = "";
- If (emptyempty (trim ($ str ))){
- Echo "emptyempty ";
- }
Then, the following error occurs: Fatal error: Can't use function return value in write context in empty. php on line 5. if no reason is found, I checked the manual on the official website.
Syntax: bool empty (mixed $ var)
If var is a non-null or non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var; and objects without any attributes will be considered empty, if var is null, TRUE is returned. Empty () is the antonym of (boolean) var except when the variable is not set.
It can be seen that empty can only be used to check the variable value, but cannot be used to check the return value of the function. the correct usage should be:
- $ Var = trim ("");
- // The result is true because $ var is a null string.
- If (emptyempty ($ var )){
- Echo 'emptyempty ';
- }
Empty (trim ($ str) is incorrect.