public function test() { $suma = 0; $rss_array = $this->link_rss(); foreach ($rss_array as $rss) { $raw_rss = file_get_contents($rss["link_rss"]); $xml_rss = new SimpleXMLElement($raw_rss); foreach ($xml_rss->channel->item as $news) { $title = $news->title->__toString(); $desc = $news->description->__toString(); $link = $news->link->__toString(); $vr = $news->pubDate->__toString(); $vr = strtotime($vr); $vreme = date("Y-m-d H:i:s", $vr); $id = Vest::ubaci_vest($title, $link, 1, $vreme, $desc, $this->id_novina, 0); $vest = new Vest($id); $reci = $vest->get_words(); $suma = $suma + count($reci); } } echo 'Broj reci = ' . $suma; }