loe(); } function tyhjenda(){$this->andmed=array();} function lisa(Andmeliides $obj){ array_push($this->andmed, $obj); $this->salvesta(); } private function salvesta(){ $abi=array(); foreach($this->andmed as $teade){ $obj=new Stdclass(); $obj->pealkiri=$teade->kysiPealkiri(); $obj->sisu=$teade->kysiSisu(); array_push($abi, $obj); } $_SESSION["teateandmed"]=json_encode($abi); } private function loe(){ if(isSet($_SESSION["teateandmed"])){ $abi=json_decode($_SESSION["teateandmed"]); $this->andmed=array(); foreach($abi as $teade){ array_push($this->andmed, new Andmeobjekt($teade->pealkiri, $teade->sisu)); } } } function kysiAndmeLiidesed(){ return $this->andmed; } //Koosta lihtne demofail paari kirje lisamise ja vaatamisega }