Skip to content

Instantly share code, notes, and snippets.

@jamierumbelow
Created January 5, 2012 11:34
Show Gist options
  • Save jamierumbelow/1564900 to your computer and use it in GitHub Desktop.
Save jamierumbelow/1564900 to your computer and use it in GitHub Desktop.
A simple currency helper for PHP. Includes clever display and currency conversion.
{
"aed": {
"priority": 100,
"iso_code": "AED",
"name": "United Arab Emirates Dirham",
"symbol": "د.إ",
"subunit": "Fils",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "784"
},
"afn": {
"priority": 100,
"iso_code": "AFN",
"name": "Afghan Afghani",
"symbol": "؋",
"subunit": "Pul",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "971"
},
"all": {
"priority": 100,
"iso_code": "ALL",
"name": "Albanian Lek",
"symbol": "L",
"subunit": "Qintar",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "008"
},
"amd": {
"priority": 100,
"iso_code": "AMD",
"name": "Armenian Dram",
"symbol": "դր.",
"subunit": "Luma",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "051"
},
"ang": {
"priority": 100,
"iso_code": "ANG",
"name": "Netherlands Antillean Gulden",
"symbol": "ƒ",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "ƒ",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "532"
},
"aoa": {
"priority": 100,
"iso_code": "AOA",
"name": "Angolan Kwanza",
"symbol": "Kz",
"subunit": "Cêntimo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "973"
},
"ars": {
"priority": 100,
"iso_code": "ARS",
"name": "Argentine Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "032"
},
"aud": {
"priority": 4,
"iso_code": "AUD",
"name": "Australian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "036"
},
"awg": {
"priority": 100,
"iso_code": "AWG",
"name": "Aruban Florin",
"symbol": "ƒ",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "ƒ",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "533"
},
"azn": {
"priority": 100,
"iso_code": "AZN",
"name": "Azerbaijani Manat",
"symbol": null,
"subunit": "Qəpik",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "944"
},
"bam": {
"priority": 100,
"iso_code": "BAM",
"name": "Bosnia and Herzegovina Convertible Mark",
"symbol": "KM or КМ",
"subunit": "Fening",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "977"
},
"bbd": {
"priority": 100,
"iso_code": "BBD",
"name": "Barbadian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "052"
},
"bdt": {
"priority": 100,
"iso_code": "BDT",
"name": "Bangladeshi Taka",
"symbol": "৳",
"subunit": "Paisa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "050"
},
"bgn": {
"priority": 100,
"iso_code": "BGN",
"name": "Bulgarian Lev",
"symbol": "лв",
"subunit": "Stotinka",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "975"
},
"bhd": {
"priority": 100,
"iso_code": "BHD",
"name": "Bahraini Dinar",
"symbol": "ب.د",
"subunit": "Fils",
"subunit_to_unit": 1000,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "048"
},
"bif": {
"priority": 100,
"iso_code": "BIF",
"name": "Burundian Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "108"
},
"bmd": {
"priority": 100,
"iso_code": "BMD",
"name": "Bermudian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "060"
},
"bnd": {
"priority": 100,
"iso_code": "BND",
"name": "Brunei Dollar",
"symbol": "$",
"subunit": "Sen",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "096"
},
"bob": {
"priority": 100,
"iso_code": "BOB",
"name": "Bolivian Boliviano",
"symbol": "Bs.",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "068"
},
"brl": {
"priority": 100,
"iso_code": "BRL",
"name": "Brazilian Real",
"symbol": "R$ ",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "R$",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "986"
},
"bsd": {
"priority": 100,
"iso_code": "BSD",
"name": "Bahamian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "044"
},
"btn": {
"priority": 100,
"iso_code": "BTN",
"name": "Bhutanese Ngultrum",
"symbol": null,
"subunit": "Chertrum",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "064"
},
"bwp": {
"priority": 100,
"iso_code": "BWP",
"name": "Botswana Pula",
"symbol": "P",
"subunit": "Thebe",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "072"
},
"byr": {
"priority": 100,
"iso_code": "BYR",
"name": "Belarusian Ruble",
"symbol": "Br",
"subunit": "Kapyeyka",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "974"
},
"bzd": {
"priority": 100,
"iso_code": "BZD",
"name": "Belize Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "084"
},
"cad": {
"priority": 5,
"iso_code": "CAD",
"name": "Canadian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "124"
},
"cdf": {
"priority": 100,
"iso_code": "CDF",
"name": "Congolese Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "976"
},
"chf": {
"priority": 100,
"iso_code": "CHF",
"name": "Swiss Franc",
"symbol": "Fr",
"subunit": "Rappen",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "756"
},
"clp": {
"priority": 100,
"iso_code": "CLP",
"name": "Chilean Peso",
"symbol": "$",
"subunit": "Peso",
"subunit_to_unit": 1,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "152"
},
"cny": {
"priority": 100,
"iso_code": "CNY",
"name": "Chinese Renminbi Yuan",
"symbol": "¥",
"subunit": "Fen",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "圓",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "156"
},
"cop": {
"priority": 100,
"iso_code": "COP",
"name": "Colombian Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "170"
},
"crc": {
"priority": 100,
"iso_code": "CRC",
"name": "Costa Rican Colón",
"symbol": "₡",
"subunit": "Céntimo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₡",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "188"
},
"cuc": {
"priority": 100,
"iso_code": "CUC",
"name": "Cuban Convertible Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "931"
},
"cup": {
"priority": 100,
"iso_code": "CUP",
"name": "Cuban Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "192"
},
"cve": {
"priority": 100,
"iso_code": "CVE",
"name": "Cape Verdean Escudo",
"symbol": "$ or Esc",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "132"
},
"czk": {
"priority": 100,
"iso_code": "CZK",
"name": "Czech Koruna",
"symbol": "Kč",
"subunit": "Haléř",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "203"
},
"djf": {
"priority": 100,
"iso_code": "DJF",
"name": "Djiboutian Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "262"
},
"dkk": {
"priority": 100,
"iso_code": "DKK",
"name": "Danish Krone",
"symbol": "kr",
"subunit": "Øre",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "208"
},
"dop": {
"priority": 100,
"iso_code": "DOP",
"name": "Dominican Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "214"
},
"dzd": {
"priority": 100,
"iso_code": "DZD",
"name": "Algerian Dinar",
"symbol": "د.ج",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "012"
},
"egp": {
"priority": 100,
"iso_code": "EGP",
"name": "Egyptian Pound",
"symbol": "£ or ج.م",
"subunit": "Piastre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "818"
},
"ern": {
"priority": 100,
"iso_code": "ERN",
"name": "Eritrean Nakfa",
"symbol": "Nfk",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "232"
},
"etb": {
"priority": 100,
"iso_code": "ETB",
"name": "Ethiopian Birr",
"symbol": null,
"subunit": "Santim",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "230"
},
"eur": {
"priority": 2,
"iso_code": "EUR",
"name": "Euro",
"symbol": "€",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "€",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "978"
},
"fjd": {
"priority": 100,
"iso_code": "FJD",
"name": "Fijian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "242"
},
"fkp": {
"priority": 100,
"iso_code": "FKP",
"name": "Falkland Pound",
"symbol": "£",
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "238"
},
"gbp": {
"priority": 3,
"iso_code": "GBP",
"name": "British Pound",
"symbol": "£",
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "826"
},
"gel": {
"priority": 100,
"iso_code": "GEL",
"name": "Georgian Lari",
"symbol": "ლ",
"subunit": "Tetri",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "981"
},
"ghs": {
"priority": 100,
"iso_code": "GHS",
"name": "Ghanaian Cedi",
"symbol": "₵",
"subunit": "Pesewa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₵",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "936"
},
"gip": {
"priority": 100,
"iso_code": "GIP",
"name": "Gibraltar Pound",
"symbol": "£",
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "292"
},
"gmd": {
"priority": 100,
"iso_code": "GMD",
"name": "Gambian Dalasi",
"symbol": "D",
"subunit": "Butut",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "270"
},
"gnf": {
"priority": 100,
"iso_code": "GNF",
"name": "Guinean Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "324"
},
"gtq": {
"priority": 100,
"iso_code": "GTQ",
"name": "Guatemalan Quetzal",
"symbol": "Q",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "320"
},
"gyd": {
"priority": 100,
"iso_code": "GYD",
"name": "Guyanese Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "328"
},
"hkd": {
"priority": 100,
"iso_code": "HKD",
"name": "Hong Kong Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "344"
},
"hnl": {
"priority": 100,
"iso_code": "HNL",
"name": "Honduran Lempira",
"symbol": "L",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "340"
},
"hrk": {
"priority": 100,
"iso_code": "HRK",
"name": "Croatian Kuna",
"symbol": "kn",
"subunit": "Lipa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "191"
},
"htg": {
"priority": 100,
"iso_code": "HTG",
"name": "Haitian Gourde",
"symbol": "G",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "332"
},
"huf": {
"priority": 100,
"iso_code": "HUF",
"name": "Hungarian Forint",
"symbol": "Ft",
"subunit": "Fillér",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "348"
},
"idr": {
"priority": 100,
"iso_code": "IDR",
"name": "Indonesian Rupiah",
"symbol": "Rp",
"subunit": "Sen",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "360"
},
"ils": {
"priority": 100,
"iso_code": "ILS",
"name": "Israeli New Sheqel",
"symbol": "₪",
"subunit": "Agora",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₪",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "376"
},
"inr": {
"priority": 100,
"iso_code": "INR",
"name": "Indian Rupee",
"symbol": "₨",
"subunit": "Paisa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₨",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "356"
},
"iqd": {
"priority": 100,
"iso_code": "IQD",
"name": "Iraqi Dinar",
"symbol": "ع.د",
"subunit": "Fils",
"subunit_to_unit": 1000,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "368"
},
"irr": {
"priority": 100,
"iso_code": "IRR",
"name": "Iranian Rial",
"symbol": "﷼",
"subunit": "Dinar",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "﷼",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "364"
},
"isk": {
"priority": 100,
"iso_code": "ISK",
"name": "Icelandic Króna",
"symbol": "kr",
"subunit": "Eyrir",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "352"
},
"jmd": {
"priority": 100,
"iso_code": "JMD",
"name": "Jamaican Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "388"
},
"jod": {
"priority": 100,
"iso_code": "JOD",
"name": "Jordanian Dinar",
"symbol": "د.ا",
"subunit": "Piastre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "400"
},
"jpy": {
"priority": 6,
"iso_code": "JPY",
"name": "Japanese Yen",
"symbol": "¥",
"subunit": null,
"subunit_to_unit": 1,
"symbol_first": true,
"html_entity": "¥",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "392"
},
"kes": {
"priority": 100,
"iso_code": "KES",
"name": "Kenyan Shilling",
"symbol": "Sh",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "404"
},
"kgs": {
"priority": 100,
"iso_code": "KGS",
"name": "Kyrgyzstani Som",
"symbol": null,
"subunit": "Tyiyn",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "417"
},
"khr": {
"priority": 100,
"iso_code": "KHR",
"name": "Cambodian Riel",
"symbol": "៛",
"subunit": "Sen",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "៛",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "116"
},
"kmf": {
"priority": 100,
"iso_code": "KMF",
"name": "Comorian Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "174"
},
"kpw": {
"priority": 100,
"iso_code": "KPW",
"name": "North Korean Won",
"symbol": "₩",
"subunit": "Chŏn",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "₩",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "408"
},
"krw": {
"priority": 100,
"iso_code": "KRW",
"name": "South Korean Won",
"symbol": "₩",
"subunit": "Jeon",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₩",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "410"
},
"kwd": {
"priority": 100,
"iso_code": "KWD",
"name": "Kuwaiti Dinar",
"symbol": "د.ك",
"subunit": "Fils",
"subunit_to_unit": 1000,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "414"
},
"kyd": {
"priority": 100,
"iso_code": "KYD",
"name": "Cayman Islands Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "136"
},
"kzt": {
"priority": 100,
"iso_code": "KZT",
"name": "Kazakhstani Tenge",
"symbol": "〒",
"subunit": "Tiyn",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "398"
},
"lak": {
"priority": 100,
"iso_code": "LAK",
"name": "Lao Kip",
"symbol": "₭",
"subunit": "Att",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "₭",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "418"
},
"lbp": {
"priority": 100,
"iso_code": "LBP",
"name": "Lebanese Pound",
"symbol": "ل.ل",
"subunit": "Piastre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "422"
},
"lkr": {
"priority": 100,
"iso_code": "LKR",
"name": "Sri Lankan Rupee",
"symbol": "₨",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "௹",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "144"
},
"lrd": {
"priority": 100,
"iso_code": "LRD",
"name": "Liberian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "430"
},
"lsl": {
"priority": 100,
"iso_code": "LSL",
"name": "Lesotho Loti",
"symbol": "L",
"subunit": "Sente",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "426"
},
"ltl": {
"priority": 100,
"iso_code": "LTL",
"name": "Lithuanian Litas",
"symbol": "Lt",
"subunit": "Centas",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "440"
},
"lvl": {
"priority": 100,
"iso_code": "LVL",
"name": "Latvian Lats",
"symbol": "Ls",
"subunit": "Santīms",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "428"
},
"lyd": {
"priority": 100,
"iso_code": "LYD",
"name": "Libyan Dinar",
"symbol": "ل.د",
"subunit": "Dirham",
"subunit_to_unit": 1000,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "434"
},
"mad": {
"priority": 100,
"iso_code": "MAD",
"name": "Moroccan Dirham",
"symbol": "د.م.",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "504"
},
"mdl": {
"priority": 100,
"iso_code": "MDL",
"name": "Moldovan Leu",
"symbol": "L",
"subunit": "Ban",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "498"
},
"mga": {
"priority": 100,
"iso_code": "MGA",
"name": "Malagasy Ariary",
"symbol": null,
"subunit": "Iraimbilanja",
"subunit_to_unit": 5,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "969"
},
"mkd": {
"priority": 100,
"iso_code": "MKD",
"name": "Macedonian Denar",
"symbol": "ден",
"subunit": "Deni",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "807"
},
"mmk": {
"priority": 100,
"iso_code": "MMK",
"name": "Myanmar Kyat",
"symbol": "K",
"subunit": "Pya",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "104"
},
"mnt": {
"priority": 100,
"iso_code": "MNT",
"name": "Mongolian Tögrög",
"symbol": "₮",
"subunit": "Möngö",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "₮",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "496"
},
"mop": {
"priority": 100,
"iso_code": "MOP",
"name": "Macanese Pataca",
"symbol": "P",
"subunit": "Avo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "446"
},
"mro": {
"priority": 100,
"iso_code": "MRO",
"name": "Mauritanian Ouguiya",
"symbol": "UM",
"subunit": "Khoums",
"subunit_to_unit": 5,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "478"
},
"mur": {
"priority": 100,
"iso_code": "MUR",
"name": "Mauritian Rupee",
"symbol": "₨",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₨",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "480"
},
"mvr": {
"priority": 100,
"iso_code": "MVR",
"name": "Maldivian Rufiyaa",
"symbol": "ރ.",
"subunit": "Laari",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "462"
},
"mwk": {
"priority": 100,
"iso_code": "MWK",
"name": "Malawian Kwacha",
"symbol": "MK",
"subunit": "Tambala",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "454"
},
"mxn": {
"priority": 100,
"iso_code": "MXN",
"name": "Mexican Peso",
"symbol": "$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "484"
},
"myr": {
"priority": 100,
"iso_code": "MYR",
"name": "Malaysian Ringgit",
"symbol": "RM",
"subunit": "Sen",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "458"
},
"mzn": {
"priority": 100,
"iso_code": "MZN",
"name": "Mozambican Metical",
"symbol": "MTn",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "943"
},
"nad": {
"priority": 100,
"iso_code": "NAD",
"name": "Namibian Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "516"
},
"ngn": {
"priority": 100,
"iso_code": "NGN",
"name": "Nigerian Naira",
"symbol": "₦",
"subunit": "Kobo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "₦",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "566"
},
"nio": {
"priority": 100,
"iso_code": "NIO",
"name": "Nicaraguan Córdoba",
"symbol": "C$",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "558"
},
"nok": {
"priority": 100,
"iso_code": "NOK",
"name": "Norwegian Krone",
"symbol": "kr",
"subunit": "Øre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "kr",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "578"
},
"npr": {
"priority": 100,
"iso_code": "NPR",
"name": "Nepalese Rupee",
"symbol": "₨",
"subunit": "Paisa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₨",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "524"
},
"nzd": {
"priority": 100,
"iso_code": "NZD",
"name": "New Zealand Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "554"
},
"omr": {
"priority": 100,
"iso_code": "OMR",
"name": "Omani Rial",
"symbol": "ر.ع.",
"subunit": "Baisa",
"subunit_to_unit": 1000,
"symbol_first": true,
"html_entity": "﷼",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "512"
},
"pab": {
"priority": 100,
"iso_code": "PAB",
"name": "Panamanian Balboa",
"symbol": "B/.",
"subunit": "Centésimo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "590"
},
"pen": {
"priority": 100,
"iso_code": "PEN",
"name": "Peruvian Nuevo Sol",
"symbol": "S/.",
"subunit": "Céntimo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "S/.",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "604"
},
"pgk": {
"priority": 100,
"iso_code": "PGK",
"name": "Papua New Guinean Kina",
"symbol": "K",
"subunit": "Toea",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "598"
},
"php": {
"priority": 100,
"iso_code": "PHP",
"name": "Philippine Peso",
"symbol": "₱",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "608"
},
"pkr": {
"priority": 100,
"iso_code": "PKR",
"name": "Pakistani Rupee",
"symbol": "₨",
"subunit": "Paisa",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₨",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "586"
},
"pln": {
"priority": 100,
"iso_code": "PLN",
"name": "Polish Złoty",
"symbol": "zł",
"subunit": "Grosz",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "985"
},
"pyg": {
"priority": 100,
"iso_code": "PYG",
"name": "Paraguayan Guaraní",
"symbol": "₲",
"subunit": "Céntimo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₲",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "600"
},
"qar": {
"priority": 100,
"iso_code": "QAR",
"name": "Qatari Riyal",
"symbol": "ر.ق",
"subunit": "Dirham",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "﷼",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "634"
},
"ron": {
"priority": 100,
"iso_code": "RON",
"name": "Romanian Leu",
"symbol": "L",
"subunit": "Ban",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "946"
},
"rsd": {
"priority": 100,
"iso_code": "RSD",
"name": "Serbian Dinar",
"symbol": "din. or дин.",
"subunit": "Para",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "941"
},
"rub": {
"priority": 100,
"iso_code": "RUB",
"name": "Russian Ruble",
"symbol": "р.",
"subunit": "Kopek",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "руб",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "643"
},
"rwf": {
"priority": 100,
"iso_code": "RWF",
"name": "Rwandan Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "646"
},
"sar": {
"priority": 100,
"iso_code": "SAR",
"name": "Saudi Riyal",
"symbol": "ر.س",
"subunit": "Hallallah",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "﷼",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "682"
},
"sbd": {
"priority": 100,
"iso_code": "SBD",
"name": "Solomon Islands Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "090"
},
"scr": {
"priority": 100,
"iso_code": "SCR",
"name": "Seychellois Rupee",
"symbol": "₨",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "₨",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "690"
},
"sdg": {
"priority": 100,
"iso_code": "SDG",
"name": "Sudanese Pound",
"symbol": "£",
"subunit": "Piastre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "938"
},
"sek": {
"priority": 100,
"iso_code": "SEK",
"name": "Swedish Krona",
"symbol": "kr",
"subunit": "Öre",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "752"
},
"sgd": {
"priority": 100,
"iso_code": "SGD",
"name": "Singapore Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "702"
},
"shp": {
"priority": 100,
"iso_code": "SHP",
"name": "Saint Helenian Pound",
"symbol": "£",
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "654"
},
"skk": {
"priority": 100,
"iso_code": "SKK",
"name": "Slovak Koruna",
"symbol": "Sk",
"subunit": "Halier",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "703"
},
"sll": {
"priority": 100,
"iso_code": "SLL",
"name": "Sierra Leonean Leone",
"symbol": "Le",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "694"
},
"sos": {
"priority": 100,
"iso_code": "SOS",
"name": "Somali Shilling",
"symbol": "Sh",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "706"
},
"srd": {
"priority": 100,
"iso_code": "SRD",
"name": "Surinamese Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "968"
},
"std": {
"priority": 100,
"iso_code": "STD",
"name": "São Tomé and Príncipe Dobra",
"symbol": "Db",
"subunit": "Cêntimo",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "678"
},
"svc": {
"priority": 100,
"iso_code": "SVC",
"name": "Salvadoran Colón",
"symbol": "₡",
"subunit": "Centavo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₡",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "222"
},
"syp": {
"priority": 100,
"iso_code": "SYP",
"name": "Syrian Pound",
"symbol": "£ or ل.س",
"subunit": "Piastre",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "760"
},
"szl": {
"priority": 100,
"iso_code": "SZL",
"name": "Swazi Lilangeni",
"symbol": "L",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "748"
},
"thb": {
"priority": 100,
"iso_code": "THB",
"name": "Thai Baht",
"symbol": "฿",
"subunit": "Satang",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "฿",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "764"
},
"tjs": {
"priority": 100,
"iso_code": "TJS",
"name": "Tajikistani Somoni",
"symbol": "ЅМ",
"subunit": "Diram",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "972"
},
"tmm": {
"priority": 100,
"iso_code": "TMM",
"name": "Turkmenistani Manat",
"symbol": "m",
"subunit": "Tennesi",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "795"
},
"tnd": {
"priority": 100,
"iso_code": "TND",
"name": "Tunisian Dinar",
"symbol": "د.ت",
"subunit": "Millime",
"subunit_to_unit": 1000,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "788"
},
"top": {
"priority": 100,
"iso_code": "TOP",
"name": "Tongan Paʻanga",
"symbol": "T$",
"subunit": "Seniti",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "776"
},
"try": {
"priority": 100,
"iso_code": "TRY",
"name": "Turkish Lira",
"symbol": "TL",
"subunit": "kuruş",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "949"
},
"ttd": {
"priority": 100,
"iso_code": "TTD",
"name": "Trinidad and Tobago Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "780"
},
"twd": {
"priority": 100,
"iso_code": "TWD",
"name": "New Taiwan Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "901"
},
"tzs": {
"priority": 100,
"iso_code": "TZS",
"name": "Tanzanian Shilling",
"symbol": "Sh",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "834"
},
"uah": {
"priority": 100,
"iso_code": "UAH",
"name": "Ukrainian Hryvnia",
"symbol": "₴",
"subunit": "Kopiyka",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "&#x20B4",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "980"
},
"ugx": {
"priority": 100,
"iso_code": "UGX",
"name": "Ugandan Shilling",
"symbol": "Sh",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "800"
},
"usd": {
"priority": 1,
"iso_code": "USD",
"name": "United States Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "840"
},
"uyu": {
"priority": 100,
"iso_code": "UYU",
"name": "Uruguayan Peso",
"symbol": "$",
"subunit": "Centésimo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "₱",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "858"
},
"uzs": {
"priority": 100,
"iso_code": "UZS",
"name": "Uzbekistani Som",
"symbol": null,
"subunit": "Tiyin",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "860"
},
"vef": {
"priority": 100,
"iso_code": "VEF",
"name": "Venezuelan Bolívar",
"symbol": "Bs F",
"subunit": "Céntimo",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "937"
},
"vnd": {
"priority": 100,
"iso_code": "VND",
"name": "Vietnamese Đồng",
"symbol": "₫",
"subunit": "Hào",
"subunit_to_unit": 10,
"symbol_first": true,
"html_entity": "₫",
"decimal_mark": ",",
"thousands_separator": ".",
"iso_numeric": "704"
},
"vuv": {
"priority": 100,
"iso_code": "VUV",
"name": "Vanuatu Vatu",
"symbol": "Vt",
"subunit": null,
"subunit_to_unit": 1,
"symbol_first": true,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "548"
},
"wst": {
"priority": 100,
"iso_code": "WST",
"name": "Samoan Tala",
"symbol": "T",
"subunit": "Sene",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "882"
},
"xaf": {
"priority": 100,
"iso_code": "XAF",
"name": "Central African Cfa Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "950"
},
"xcd": {
"priority": 100,
"iso_code": "XCD",
"name": "East Caribbean Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "951"
},
"xof": {
"priority": 100,
"iso_code": "XOF",
"name": "West African Cfa Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "952"
},
"xpf": {
"priority": 100,
"iso_code": "XPF",
"name": "Cfp Franc",
"symbol": "Fr",
"subunit": "Centime",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "953"
},
"yer": {
"priority": 100,
"iso_code": "YER",
"name": "Yemeni Rial",
"symbol": "﷼",
"subunit": "Fils",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "﷼",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "886"
},
"zar": {
"priority": 100,
"iso_code": "ZAR",
"name": "South African Rand",
"symbol": "R",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "R",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "710"
},
"zmk": {
"priority": 100,
"iso_code": "ZMK",
"name": "Zambian Kwacha",
"symbol": "ZK",
"subunit": "Ngwee",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "894"
},
"zwd": {
"priority": 100,
"iso_code": "ZWD",
"name": "Zimbabwean Dollar",
"symbol": "$",
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "$",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "716"
}
}
<?php
/**
* I know this is horrid. Sorry.
*/
function currency_list() {
static $_currencies;
if (!$_currencies) {
$_currencies = json_decode(file_get_contents(APPPATH . 'config/currencies.json'));
}
return $_currencies;
}
function currency_rates() {
static $_currencies_rates;
if (!$_currencies_rates) {
get_instance()->load->library('curl');
$json = get_instance()->curl->simple_get('https://raw.github.com/currencybot/open-exchange-rates/master/latest.json');
$_currencies_rates = json_decode($json)->rates;
}
return $_currencies_rates;
}
/**
* Currency
*
* Represents a single currency
*/
class Currency {
protected $info = array();
/**
* Create a new currency instance, using the
* currency's short name.
*/
public function __construct($name) {
$currencies = currency_list();
$name = strtolower($name);
if (isset($currencies->$name)) {
$this->info = $currencies->$name;
} else {
$this->info = $currencies->usd;
}
}
/**
* Return the currency's name
*/
public function name() { return $this->info->name; }
/**
* Return the currency's code
*/
public function code() { return $this->info->iso_code; }
/**
* Return the currency's symbol
*/
public function symbol($html = TRUE) {
return ($html && $this->info->html_entity) ? $this->info->html_entity : $this->info->symbol;
}
/**
* Pence in a pound, cents in a dollar...
*/
public function subunit_to_unit() { return $this->info->subunit_to_unit; }
/**
* Is the symbol before or after?
*/
public function symbol_before() { return $this->info->symbol_first; }
/**
* Aesthetic stuff to pass into number_format
*/
public function thousands_separator() { return $this->info->thousands_separator; }
public function decimal_mark() { return $this->info->decimal_mark; }
/**
* We base all the rates off USD, so get the rate in USD
*/
public function rate_to_usd() {
if (!isset($this->info->current_rate)) {
$this->info->current_rate = currency_rates()->{$this->code()};
}
return $this->info->current_rate;
}
}
class Money {
protected $amount = 0;
protected $currency = FALSE;
/**
* Takes an integer value of the subunit and
* a currency code; returns a usable Money instance
*/
public function __construct($subunit, $currency = 'usd') {
$this->amount = $subunit;
$this->currency = new Currency($currency);
}
/**
* Output a display-friendly representation of the dosh.
* Accounts for each individual currency's preferences:
* symbol before/after, thousands and decimal separator.
*/
public function to_display() {
$string = ($this->currency->symbol_before()) ? $this->currency->symbol() : '';
$string .= number_format(($this->amount / $this->currency->subunit_to_unit()), 2, $this->currency->decimal_mark(), $this->currency->thousands_separator());
$string .= (!$this->currency->symbol_before()) ? $this->currency->symbol() : '';
return $string;
}
/**
* Convert one currency to another
*/
public function to_currency($currency = 'usd') {
$rate_to_usd = $this->currency->rate_to_usd();
$in_usd = ($this->amount / $this->currency->subunit_to_unit()) / $rate_to_usd;
$new_currency = new Currency($currency);
return ($in_usd * $new_currency->rate()) * $new_currency->subunit_to_unit();
}
}
function c($amount, $currency) {
$money = new Money($amount, $currency);
return $money->to_display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment