Subversion Repositories cheapmusic

Rev

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.672904,
          "AFN" => 78.250404,
          "ALL" => 111.203989,
          "AMD" => 475.870403,
          "ANG" => 1.755341,
          "AOA" => 478.222504,
          "ARS" => 59.922296,
          "AUD" => 1.465804,
          "AWG" => 1.8,
          "AZN" => 1.70397,
          "BAM" => 1.760059,
          "BBD" => 2.019475,
          "BDT" => 84.71715,
          "BGN" => 1.765204,
          "BHD" => 0.377013,
          "BIF" => 1871,
          "BMD" => 1,
          "BND" => 1.363506,
          "BOB" => 6.916431,
          "BRL" => 4.004504,
          "BSD" => 1.000198,
          "BTC" => 0.000115,
          "BTN" => 70.93684,
          "BWP" => 10.836768,
          "BYN" => 2.043951,
          "BYR" => 19600,
          "BZD" => 2.016118,
          "CAD" => 1.30605,
          "CDF" => 1665.000362,
          "CHF" => 0.994465,
          "CLF" => 0.026347,
          "CLP" => 727.000361,
          "CNY" => 7.065704,
          "COP" => 3396.5,
          "CRC" => 584.01879,
          "CUC" => 1,
          "CUP" => 26.5,
          "CVE" => 99.650394,
          "CZK" => 23.060504,
          "DJF" => 177.720394,
          "DKK" => 6.741704,
          "DOP" => 53.050393,
          "DZD" => 119.67694,
          "EGP" => 16.136456,
          "ERN" => 15.000358,
          "ETB" => 29.803876,
          "EUR" => 0.902486,
          "FJD" => 2.19704,
          "FKP" => 0.81288,
          "GBP" => 0.779606,
          "GEL" => 2.94504,
          "GGP" => 0.77961,
          "GHS" => 5.49039,
          "GIP" => 0.81288,
          "GMD" => 51.33504,
          "GNF" => 9230.000355,
          "GTQ" => 7.764088,
          "GYD" => 208.67906,
          "HKD" => 7.83825,
          "HNL" => 24.703841,
          "HRK" => 6.723638,
          "HTG" => 96.39532,
          "HUF" => 296.780388,
          "IDR" => 14035,
          "ILS" => 3.53604,
          "IMP" => 0.77961,
          "INR" => 70.840387,
          "IQD" => 1189.5,
          "IRR" => 42105.000352,
          "ISK" => 124.820386,
          "JEP" => 0.77961,
          "JMD" => 137.97315,
          "JOD" => 0.70804,
          "JPY" => 108.66504,
          "KES" => 103.503804,
          "KGS" => 69.830385,
          "KHR" => 4060.000351,
          "KMF" => 444.050384,
          "KPW" => 900.12259,
          "KRW" => 1171.820384,
          "KWD" => 0.30371,
          "KYD" => 0.833528,
          "KZT" => 388.70441,
          "LAK" => 8840.000349,
          "LBP" => 1511.746504,
          "LKR" => 181.38672,
          "LRD" => 211.503775,
          "LSL" => 14.620382,
          "LTL" => 2.95274,
          "LVL" => 0.60489,
          "LYD" => 1.403765,
          "MAD" => 9.653039,
          "MDL" => 17.512756,
          "MGA" => 3650.000347,
          "MKD" => 55.355503,
          "MMK" => 1531.31038,
          "MNT" => 2688.805389,
          "MOP" => 8.075379,
          "MRO" => 357.000346,
          "MUR" => 36.350379,
          "MVR" => 15.403741,
          "MWK" => 732.503739,
          "MXN" => 19.061704,
          "MYR" => 4.186039,
          "MZN" => 62.560377,
          "NAD" => 14.620377,
          "NGN" => 361.503727,
          "NIO" => 33.703725,
          "NOK" => 9.196604,
          "NPR" => 113.49916,
          "NZD" => 1.575052,
          "OMR" => 0.384957,
          "PAB" => 1.000198,
          "PEN" => 3.338504,
          "PGK" => 3.382504,
          "PHP" => 51.210375,
          "PKR" => 155.803704,
          "PLN" => 3.86135,
          "PYG" => 6475.278504,
          "QAR" => 3.641038,
          "RON" => 4.289604,
          "RSD" => 106.110373,
          "RUB" => 63.950604,
          "RWF" => 910,
          "SAR" => 3.750034,
          "SBD" => 8.269546,
          "SCR" => 13.738212,
          "SDG" => 45.12154,
          "SEK" => 9.684204,
          "SGD" => 1.363204,
          "SHP" => 1.320904,
          "SLL" => 9550.000339,
          "SOS" => 582.000338,
          "SRD" => 7.458038,
          "STD" => 21560.79,
          "SVC" => 8.751839,
          "SYP" => 515.000338,
          "SZL" => 14.62037,
          "THB" => 30.161996,
          "TJS" => 9.691513,
          "TMT" => 3.51,
          "TND" => 2.836504,
          "TOP" => 2.32005,
          "TRY" => 5.775104,
          "TTD" => 6.776579,
          "TWD" => 30.578038,
          "TZS" => 2303.503635,
          "UAH" => 25.161668,
          "UGX" => 3728.839504,
          "USD" => 1,
          "UYU" => 37.382782,
          "UZS" => 9445.000335,
          "VEF" => 9.987504,
          "VND" => 23208.5,
          "VUV" => 114.997681,
          "WST" => 2.717395,
          "XAF" => 590.324704,
          "XAG" => 0.055437,
          "XAU" => 0.000665,
          "XCD" => 2.70255,
          "XDR" => 0.726697,
          "XOF" => 590.000332,
          "XPF" => 108.050364,
          "YER" => 250.303597,
          "ZAR" => 14.627904,
          "ZMK" => 9001.203593,
          "ZMW" => 13.228007,
          "ZWL" => 322.000001,
    )
  );

  $rate = 1;

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

  return($rate);
}
?>