I have a very strange and unexpected problem.
empty()returns a TRUEnon-empty property for a reason unknown to me.
class MyObject
{
private $_property;
public function __construct($property)
{
$this->_property = $property;
}
public function __get($name)
{
$priv_name = "_{$name}";
if (isset($this->$priv_name))
{
return $this->$priv_name;
}
else
{
return NULL;
}
}
}
$obj = new MyObject('string value');
echo $obj->property;
echo empty($obj->property);
Will this mean that the magic function is __get()not called when used empty()?
by the way. I am running PHP version 5.0.4
source
share