I need to extract data from a crypto API and I am using this PHP code
$url = 'https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH&tsyms=USD,EUR';
$data = file_get_contents($url);
$priceInfo = json_decode($data);
foreach ($priceInfo as $key ){
foreach ($key as $vala => $valb ){
echo "<br> $vala--> $valb " ;
}
}
which is returning this
USD--> 49463.82
EUR--> 40802.62
USD--> 1630.65
EUR--> 1345.66
How should I change the code to show this ?
BTC USD--> 49463.82
BTC EUR--> 40802.62
ETH USD--> 1630.65
ETH EUR--> 1345.66
The array $priceInfo return this
stdClass Object ( [BTC] => stdClass Object ( [USD] => 49432.16 [EUR] => 40773.08 ) [ETH] => stdClass Object ( [USD] => 1628.21 [EUR] => 1343.67 ) )