Monday, April 11, 2016

Error: Fatal error: Can't use function return value in write context

Error: Fatal error: Can't use function return value in write context

if (empty(trim($name))) {
  continue;
}

Instead, use:

if (empty($name) || trim($name) == FALSE) {
  continue;
}

Note: Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error.

No comments: