PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"; $date = file_get_contents($url); $xml = simplexml_load_string($date); $json = json_encode($xml); $array = json_decode($json, true); $eur = 100; foreach($array as $v){ for ($x=0;$x<29;$x++) { $a = $v["Cube"]["Cube"]["$x"]["@attributes"]["rate"]; $b = $v["Cube"]["Cube"]["$x"]["@attributes"]["currency"]; $c = $eur*$a; $array1[$b] = $a; echo $b." - ".round($array1[], 2)." | ".round($c, 2)."\n"; } } arsort($array1[]); //print_r($v);
Show:  
Copy Clear