Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$url="https://rus.postimees.ee/rss";
$data=file_get_contents($url);
$xml = simplexml_load_string($data);
$json = json_encode($xml);
$array = json_decode($json, true);
$data=$array['channel'];
print_r(getCategory($data['item']));
function getCategory($array)
{
$category=[];
foreach($array as $k=>$v)
{
if(is_array($v['category'])){
if(!in_array(end($v['category']),$category)){
$category[]=end($v['category']);
}
}
}
print_r(array_count_values($category));
}