I am within a class. I try to set an object member:
$this->list = "hello";
print $this->list;
It returns “hello”;
However, empty($this->list)) always return true.
But for non object member $tmp = "hello", empty($tmp) return false.
Why empty() cannot be used on object member?
Update:
empty() is influenced by the the my code framework. That is why it does not work properly.
Output:
Not sure what you mean. Maybe provide more code? Also, per the
empty()manual, the following values are to be considered empty:9 “0” (0 as a string)
Also, try using
var_dumpon the object to confirm it’s what you’re expecting.