Thursday, July 19, 2018

php - Fatal error: Can't use method return value in write context (error info below)

If you are using PHP with a version < 5.5.0, you cannot check a functions return value directly with empty.




Note:



Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.




You have to assign it to a variable first. Further, you are missing a ).




Try:



$slab_enabled = $displayData->sa_params->get('slab_enable');
if(empty($slab_enabled)) { /*do stuff*/ };


If you do not know, which version you use, you can check with echo phpversion();

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...