Subversion Repositories cheapmusic

Rev

Rev 77 | Rev 81 | 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.67297,
          "AFN" => 78.239996,
          "ALL" => 110.389788,
          "AMD" => 476.075062,
          "ANG" => 1.76595,
          "AOA" => 369.203999,
          "ARS" => 56.855028,
          "AUD" => 1.47735,
          "AWG" => 1.801,
          "AZN" => 1.704975,
          "BAM" => 1.78155,
          "BBD" => 2.02015,
          "BDT" => 84.528015,
          "BGN" => 1.780298,
          "BHD" => 0.377096,
          "BIF" => 1861,
          "BMD" => 1,
          "BND" => 1.35085,
          "BOB" => 6.915051,
          "BRL" => 4.178798,
          "BSD" => 1.00015,
          "BTC" => 0.000101,
          "BTN" => 70.89901,
          "BWP" => 10.897951,
          "BYN" => 2.05755,
          "BYR" => 19600,
          "BZD" => 2.01695,
          "CAD" => 1.32772,
          "CDF" => 1665.999902,
          "CHF" => 0.989601,
          "CLF" => 0.026191,
          "CLP" => 722.594972,
          "CNY" => 7.118502,
          "COP" => 3436,
          "CRC" => 580.99983,
          "CUC" => 1,
          "CUP" => 26.5,
          "CVE" => 100.030502,
          "CZK" => 23.554991,
          "DJF" => 177.720262,
          "DKK" => 6.796598,
          "DOP" => 51.494971,
          "DZD" => 120.339803,
          "EGP" => 16.303979,
          "ERN" => 14.999836,
          "ETB" => 29.5029,
          "EUR" => 0.90995,
          "FJD" => 2.18835,
          "FKP" => 0.80498,
          "GBP" => 0.8047,
          "GEL" => 2.969859,
          "GGP" => 0.804737,
          "GHS" => 5.507402,
          "GIP" => 0.80501,
          "GMD" => 50.394989,
          "GNF" => 9234.999987,
          "GTQ" => 7.71955,
          "GYD" => 208.714991,
          "HKD" => 7.84036,
          "HNL" => 24.694983,
          "HRK" => 6.742999,
          "HTG" => 95.671968,
          "HUF" => 305.029534,
          "IDR" => 14076.3,
          "ILS" => 3.514796,
          "IMP" => 0.804737,
          "INR" => 70.819002,
          "IQD" => 1190,
          "IRR" => 42104.999813,
          "ISK" => 124.859807,
          "JEP" => 0.804737,
          "JMD" => 136.080006,
          "JOD" => 0.708898,
          "JPY" => 107.492011,
          "KES" => 103.910302,
          "KGS" => 69.824502,
          "KHR" => 4104.999876,
          "KMF" => 448.324971,
          "KPW" => 900.04289,
          "KRW" => 1195.790189,
          "KWD" => 0.3038,
          "KYD" => 0.83384,
          "KZT" => 386.650089,
          "LAK" => 8819.999862,
          "LBP" => 1507.549896,
          "LKR" => 181.49623,
          "LRD" => 208.349552,
          "LSL" => 14.880348,
          "LTL" => 2.95274,
          "LVL" => 0.60489,
          "LYD" => 1.409682,
          "MAD" => 9.68375,
          "MDL" => 17.685,
          "MGA" => 3749.999817,
          "MKD" => 55.982503,
          "MMK" => 1520.250053,
          "MNT" => 2666.138182,
          "MOP" => 8.0802,
          "MRO" => 357.000346,
          "MUR" => 36.350497,
          "MVR" => 15.403834,
          "MWK" => 719.024986,
          "MXN" => 19.443398,
          "MYR" => 4.180983,
          "MZN" => 61.819862,
          "NAD" => 14.880061,
          "NGN" => 361.50406,
          "NIO" => 33.608796,
          "NOK" => 9.049498,
          "NPR" => 113.434975,
          "NZD" => 1.59105,
          "OMR" => 0.385049,
          "PAB" => 1.00045,
          "PEN" => 3.364302,
          "PGK" => 3.40355,
          "PHP" => 52.125499,
          "PKR" => 156.440104,
          "PLN" => 3.99663,
          "PYG" => 6392.204112,
          "QAR" => 3.64175,
          "RON" => 4.323399,
          "RSD" => 107.029906,
          "RUB" => 63.849103,
          "RWF" => 922.5,
          "SAR" => 3.75145,
          "SBD" => 8.2759,
          "SCR" => 13.720472,
          "SDG" => 45.139025,
          "SEK" => 9.722065,
          "SGD" => 1.3782,
          "SHP" => 1.320897,
          "SLL" => 9449.999854,
          "SOS" => 581.000155,
          "SRD" => 7.457987,
          "STD" => 21560.79,
          "SVC" => 8.755599,
          "SYP" => 515.000251,
          "SZL" => 14.880154,
          "THB" => 30.470283,
          "TJS" => 9.69565,
          "TMT" => 3.5,
          "TND" => 2.860902,
          "TOP" => 2.328402,
          "TRY" => 5.726904,
          "TTD" => 6.77355,
          "TWD" => 30.994003,
          "TZS" => 2298.45004,
          "UAH" => 24.417028,
          "UGX" => 3674.102803,
          "USD" => 1,
          "UYU" => 36.789741,
          "UZS" => 9410.000286,
          "VEF" => 9.987499,
          "VND" => 23203,
          "VUV" => 118.103244,
          "WST" => 2.688896,
          "XAF" => 597.530171,
          "XAG" => 0.053874,
          "XAU" => 0.000657,
          "XCD" => 2.70255,
          "XDR" => 0.73075,
          "XOF" => 600.499588,
          "XPF" => 109.000198,
          "YER" => 250.350259,
          "ZAR" => 14.87235,
          "ZMK" => 9001.195264,
          "ZMW" => 13.163006,
          "ZWL" => 322.000001,
    )
  );

  $rate = 1;

  if (array_key_exists($source, $currencyRates)) {
    if (array_key_exists($target, $currencyRates[$source])) {
          $rate = $currencyRates[$source][$target];
    }
  }

  return($rate);
}
?>