// creer l'id du champ extra : function make_id(){ // creer un hash $hash = array(); foreach ($this as $cle=>$val) { if ($cle[0]!=='_') { $hash[] = $val; } } $this->_id = substr(md5(serialize($hash)),0,6); } // determiner un identifiant function get_id(){ if (!$this->_id) $this->make_id(); return $this->_id; } // transformer en tableau PHP les variable publiques de la classe. function toArray(){ $extra = array(); foreach ($this as $cle=>$val) { if ($cle[0]!=='_') { $extra[$cle] = $val; } } $extra['id_extra'] = $this->get_id(); return $extra; }