Un ejemplo:
Código PHP:
Ver originalclass Foo {
private $_attributes = array();
public function __construct() {}
public function __set($sVariable, $sData) {
$this->_attributes[$sVariable] = $sData;
}
public function __get($sVariable) {
return $this->_attributes[$sVariable];
}
public function dumpAttributes() {
}
}
$bar = new Foo();
$bar->foo = "baz";
$bar->baz = "foo";
$bar->anumber = 1;
$bar->dumpAttributes();
Saludos.