PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $url = "https://rus.postimees.ee/rss"; $xmlstring = file_get_contents($url); $xml = simplexml_load_string($xmlstring); $json = json_encode ($xml); $array = json_decode ($json,TRUE); $news=$array['channel']['item']; $authorList=[]; foreach ($news as $v){ if(is_array($v['author'])){ foreach($v['author'] as $author){ $authorList[]=$author; } }else{ $authorList[]=$v['author']; } } $arr = []; foreach($authorList as $v){ if(isset($arr[$v])){ $arr[$v]++; }else{ $arr[$v]=0; } } print_r ($arr)
Show:  
Copy Clear