<?php
$source = 'https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/usd.json';
$arr = ['try','bnb','algo','atom']; //usd - x pariteleri
$currency = json_decode(file_get_contents($source),true);
?>
<html>
<body>
<?php foreach($arr as $arrVal): ?>
<div style="display:block;">
usd to <?php echo $arrVal; ?>: <span id="<?php echo $arrVal; ?>"><?php echo $currency['usd'][$arrVal]; ?></span>
</div>
<?php endforeach; ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
setInterval(function(){
$.getJSON("<?php echo $source; ?>", function(x){
<?php foreach($arr as $arrVal): ?>
$("#<?php echo $arrVal; ?>").text(x['usd']['<?php echo $arrVal; ?>']);
<?php endforeach; ?>
//console.log(x);
});
},5000);
</script>
</body>
</html>