Ho risolto così:
codice:class test{ public function __get($var){ if( isset($this->$var) ){ return $this->$var; }else{ echo "$var doesn't exists in ".__CLASS__; } } public function __set($var, $value){ $this->$var = $value; } public function array2object($data){ foreach($data as $key => $value){ $this->__set($key, $value); } } }

Rispondi quotando