PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php include ("config.php"); $xmlstring = file_get_contents(POSTIMEES_URL); $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA); $json = json_encode($xml); $array = json_decode($json,TRUE); $x= 1; foreach ($array['channel']['item'] as $key => $value){ getCategory($value); echo $x." ".$value["title"]."<br>"; $x++; } function getCategory($data) { if(!isset($data['category'])){ return; } $category = is_array($data['category']) ? $data['category'] : [$data['category']]; foreach($category as $c){ echo $c; if($c !==end($category)){ echo "=>"; } } echo "<br>"; } $array1 = $array2 = array("category", "category", "category", "category"); natsort($array2); echo "\nСортировка natural order\n"; print_r($array2);
Show:  
Copy Clear