Hello !
Simple class for example:
class Foo
{
protected $_bar;
public function setBar( $value ) {
$this->_bar = $value;
}
}
And here is the question:
$obj = new Foo();
var_dump( empty( $obj ) ); // true
$obj->setBar( 'foobar' );
var_dump( empty( $obj ) ); // false
Is it possible to change class's behaviour with testing it with empty()
function so it will returns true
when object is not filled with data ?
I know about magic function __isset( $name )
but it is called only when we test specific field like:
empty( $obj->someField );
but not when test whole object.