php - looping though and remixing $var -
ok, having small issue, need loop though $usd,$aud etc , possible currency exchange rates e.g $usd:$aud - $aud:$usd, $usd:$nzd - $nzd:$usd
here code using
<?php $usd = 'usd'; # usa dollar $nzd = 'nzd'; #new zealand dollar $kwd = 'jpd'; #japanese dollar $gbp = 'gbp'; #uk pound $aud = 'aud'; $url = 'http://finance.yahoo.com/d/quotes.csv?f=l1d1t1&s='.$gbp.$aud.'=x'; $handle = fopen($url, 'r'); if ($handle) { $result = fgetcsv($handle); fclose($handle); } echo '1 '.$aud.' worth '.$result[0].' '.$usd.' based on data on '.$result[1].' '.$result[2]; ?> what need away make sure looks @ different ways rates go together.
my first thought while or loop not sure, help
$currencies = array($used, $nzd, $kwd, $gbp, $aud); foreach ($currencies $from) foreach ($currencies $to) if ($from != $to) // query api conversion $from $to
Comments
Post a Comment