PHP-Code:
class Base
{
private $_properties;
public function __construct($properties){
$this->_properties = $properties;
}
public function __set($index, $value)
{
if(in_array($index, $this->_properties)) {
$this->$index = $value; // <-- Zuweisung so nicht möglich, warum nicht?
}
else {
pre($index.' << is not a class variable<br>');
return false;
}
}
}
class Child extends Base
{
private $bla
private $blabla;
public function __construct(){
parent::__construct(get_object_vars($this));
}
}
Kommentar