. * */ // A magical class filled with ponies class memory_object { private $_data = array(); public $properties; public function __construct($data) { foreach ($data as $key => $value) { if (in_array($key, $this->properties)) { $this->_data[$key] = $value; } } } public function __set($name, $value) { if (!in_array($name, $this->properties)) { return false; } $this->_data[$name] = $value; } public function __get($name) { if (!in_array($name, $this->properties)) { return false; } return isset($this->_data[$name]) ? $this->_data[$name] : null; } }