Rev 84 | Rev 87 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
function getExchangeRate($source, $target) {
$currencyRates = array (
"USD" => array (
"AED" => 3.67285,
"AFN" => 78.24998,
"ALL" => 111.198929,
"AMD" => 476.029868,
"ANG" => 1.754568,
"AOA" => 490.521023,
"ARS" => 59.296203,
"AUD" => 1.462595,
"AWG" => 1.8,
"AZN" => 1.731123,
"BAM" => 1.762088,
"BBD" => 2.016379,
"BDT" => 84.66631,
"BGN" => 1.763011,
"BHD" => 0.376979,
"BIF" => 1870,
"BMD" => 1,
"BND" => 1.361839,
"BOB" => 6.91316,
"BRL" => 3.9818,
"BSD" => 0.999766,
"BTC" => 0.000107,
"BTN" => 70.72622,
"BWP" => 10.808227,
"BYN" => 2.047299,
"BYR" => 19600,
"BZD" => 2.00946,
"CAD" => 1.306181,
"CDF" => 1665.999764,
"CHF" => 0.995705,
"CLF" => 0.026209,
"CLP" => 723.174966,
"CNY" => 7.067904,
"COP" => 3383.5,
"CRC" => 581.29645,
"CUC" => 1,
"CUP" => 26.5,
"CVE" => 99.649429,
"CZK" => 22.988399,
"DJF" => 177.720095,
"DKK" => 6.73335,
"DOP" => 53.040173,
"DZD" => 119.640023,
"EGP" => 16.137899,
"ERN" => 15.000234,
"ETB" => 29.804435,
"EUR" => 0.901265,
"FJD" => 2.196984,
"FKP" => 0.81288,
"GBP" => 0.777705,
"GEL" => 2.944996,
"GGP" => 0.777629,
"GHS" => 5.504998,
"GIP" => 0.81288,
"GMD" => 51.11016,
"GNF" => 9237.510825,
"GTQ" => 7.745954,
"GYD" => 208.71735,
"HKD" => 7.83985,
"HNL" => 24.704156,
"HRK" => 6.716975,
"HTG" => 96.622398,
"HUF" => 295.796995,
"IDR" => 14015,
"ILS" => 3.53284,
"IMP" => 0.777629,
"INR" => 70.7125,
"IQD" => 1190,
"IRR" => 42105.000322,
"ISK" => 124.659902,
"JEP" => 0.777629,
"JMD" => 137.17758,
"JOD" => 0.708499,
"JPY" => 108.984497,
"KES" => 103.50251,
"KGS" => 69.8294,
"KHR" => 4055.999841,
"KMF" => 444.050293,
"KPW" => 900.062982,
"KRW" => 1168.66977,
"KWD" => 0.30375,
"KYD" => 0.833176,
"KZT" => 387.68413,
"LAK" => 8840.000042,
"LBP" => 1512.000141,
"LKR" => 181.42598,
"LRD" => 211.624951,
"LSL" => 14.550244,
"LTL" => 2.95274,
"LVL" => 0.60489,
"LYD" => 1.405019,
"MAD" => 9.643023,
"MDL" => 17.519708,
"MGA" => 3650.000163,
"MKD" => 55.400888,
"MMK" => 1530.5862,
"MNT" => 2689.102641,
"MOP" => 8.073163,
"MRO" => 357.000346,
"MUR" => 36.350059,
"MVR" => 15.440009,
"MWK" => 731.999391,
"MXN" => 19.055102,
"MYR" => 4.186028,
"MZN" => 62.614961,
"NAD" => 14.549972,
"NGN" => 361.511773,
"NIO" => 33.70394,
"NOK" => 9.20437,
"NPR" => 113.1499,
"NZD" => 1.576245,
"OMR" => 0.385029,
"PAB" => 0.999775,
"PEN" => 3.3345,
"PGK" => 3.382499,
"PHP" => 51.150504,
"PKR" => 155.840524,
"PLN" => 3.85342,
"PYG" => 6477.7426,
"QAR" => 3.640997,
"RON" => 4.286702,
"RSD" => 105.809808,
"RUB" => 63.733501,
"RWF" => 920,
"SAR" => 3.750676,
"SBD" => 8.269546,
"SCR" => 13.731464,
"SDG" => 45.101131,
"SEK" => 9.69938,
"SGD" => 1.361895,
"SHP" => 1.320901,
"SLL" => 9575.000228,
"SOS" => 580.000416,
"SRD" => 7.458024,
"STD" => 21560.79,
"SVC" => 8.748142,
"SYP" => 514.999745,
"SZL" => 14.549464,
"THB" => 30.234455,
"TJS" => 9.692598,
"TMT" => 3.5,
"TND" => 2.828001,
"TOP" => 2.322401,
"TRY" => 5.720302,
"TTD" => 6.751234,
"TWD" => 30.556992,
"TZS" => 2302.914496,
"UAH" => 25.126447,
"UGX" => 3709.08599,
"USD" => 1,
"UYU" => 37.394704,
"UZS" => 9445.000319,
"VEF" => 9.987499,
"VND" => 23208.5,
"VUV" => 117.453257,
"WST" => 2.668831,
"XAF" => 591.03212,
"XAG" => 0.056027,
"XAU" => 0.00067,
"XCD" => 2.70255,
"XDR" => 0.72715,
"XOF" => 590.000381,
"XPF" => 108.025011,
"YER" => 250.349565,
"ZAR" => 14.557899,
"ZMK" => 9001.19822,
"ZMW" => 13.271679,
"ZWL" => 322.000001,
)
);
$rate = 1;
if (array_key_exists($source, $currencyRates)) {
if (array_key_exists($target, $currencyRates[$source])) {
$rate = $currencyRates[$source][$target];
}
}
return($rate);
}
?>