Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?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']); # } } } return $category; }
Copy Clear