Saturday 17 December 2016

php - Fatal error: Can't use function return value

empty requires a variable as if the parameter were passed by reference:



Note:
empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($name)).



So you could do this:


$var = is_resource(true);
echo empty($var);

But as is_resource already returns a boolean value, you actually don’t need another testing function.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...