Alexander Belyaev wrote: > > Any comments, suggestions? > ... > function __get($prop_name, &$prop_value) > { > if($prop_name=='id' or $prop_name=='version' or $prop_name=='classname' or > $prop_name=='data') > { > $prop_value = $this->$prop_name; > return true; > } > > $rt = mysql_query("select version from $this->classname where > id=$this->id"); > $ver = mysql_result($rt,0); > if($ver != $this->version) $this->reload(); > $prop_value = $this->data[$prop_name]; > return true; > }
Yes. If you have existing class variables then ext/overload will automatically use them instead of invoking __get() method. So this could be rewritten as: function __get($prop_name, &$prop_value) { $rt = mysql_query("select version from $this->classname where id=$this->id"); $ver = mysql_result($rt, 0); if ($ver != $this->version) $this->reload(); $prop_value = $this->data[$prop_name]; return true; } -Andrei * "I'll need daily status reports on why you're so behind." -- Dilbert's boss * -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php