Home > Article > Backend Development > php empty() error, Fatal error: Can’t use function return_PHP tutorial
Today when I was using the empty function, I got a Fatal error: Can't use function return value in write context error message. I thought it was very strange. I have been using this function for a long time. What happened today? Let's take a look at it. analysis process.
Error message
Fatal error: Can’t use function return value in write context in empty.php on line 5
My code is written like this
The code is as follows
|
Copy code
|
||||
$str=” “; Then it appeared
Fatal error: Can’t use function return value in write context in empty.php on line 5 I couldn’t see the reason so I went to the official website and checked the manual. bool empty ( mixed $var )
If var is a non-empty or non-zero value, empty() returns FALSE. In other words, "", 0, "0", NULL, FALSE, array(), var $var; and objects without any properties will be considered empty, and TRUE will be returned if var is empty. empty() is the antonym of (boolean) var, except that it does not produce a warning when the variable is not set. |
The code is as follows
|
Copy code |