-
-
Save champsupertramp/95493faa7ba12b61bf6e to your computer and use it in GitHub Desktop.
World Currency list in PHP Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array ( | |
'ALL' => 'Albania Lek', | |
'AFN' => 'Afghanistan Afghani', | |
'ARS' => 'Argentina Peso', | |
'AWG' => 'Aruba Guilder', | |
'AUD' => 'Australia Dollar', | |
'AZN' => 'Azerbaijan New Manat', | |
'BSD' => 'Bahamas Dollar', | |
'BBD' => 'Barbados Dollar', | |
'BDT' => 'Bangladeshi taka', | |
'BYR' => 'Belarus Ruble', | |
'BZD' => 'Belize Dollar', | |
'BMD' => 'Bermuda Dollar', | |
'BOB' => 'Bolivia Boliviano', | |
'BAM' => 'Bosnia and Herzegovina Convertible Marka', | |
'BWP' => 'Botswana Pula', | |
'BGN' => 'Bulgaria Lev', | |
'BRL' => 'Brazil Real', | |
'BND' => 'Brunei Darussalam Dollar', | |
'KHR' => 'Cambodia Riel', | |
'CAD' => 'Canada Dollar', | |
'KYD' => 'Cayman Islands Dollar', | |
'CLP' => 'Chile Peso', | |
'CNY' => 'China Yuan Renminbi', | |
'COP' => 'Colombia Peso', | |
'CRC' => 'Costa Rica Colon', | |
'HRK' => 'Croatia Kuna', | |
'CUP' => 'Cuba Peso', | |
'CZK' => 'Czech Republic Koruna', | |
'DKK' => 'Denmark Krone', | |
'DOP' => 'Dominican Republic Peso', | |
'XCD' => 'East Caribbean Dollar', | |
'EGP' => 'Egypt Pound', | |
'SVC' => 'El Salvador Colon', | |
'EEK' => 'Estonia Kroon', | |
'EUR' => 'Euro Member Countries', | |
'FKP' => 'Falkland Islands (Malvinas) Pound', | |
'FJD' => 'Fiji Dollar', | |
'GHC' => 'Ghana Cedis', | |
'GIP' => 'Gibraltar Pound', | |
'GTQ' => 'Guatemala Quetzal', | |
'GGP' => 'Guernsey Pound', | |
'GYD' => 'Guyana Dollar', | |
'HNL' => 'Honduras Lempira', | |
'HKD' => 'Hong Kong Dollar', | |
'HUF' => 'Hungary Forint', | |
'ISK' => 'Iceland Krona', | |
'INR' => 'India Rupee', | |
'IDR' => 'Indonesia Rupiah', | |
'IRR' => 'Iran Rial', | |
'IMP' => 'Isle of Man Pound', | |
'ILS' => 'Israel Shekel', | |
'JMD' => 'Jamaica Dollar', | |
'JPY' => 'Japan Yen', | |
'JEP' => 'Jersey Pound', | |
'KZT' => 'Kazakhstan Tenge', | |
'KPW' => 'Korea (North) Won', | |
'KRW' => 'Korea (South) Won', | |
'KGS' => 'Kyrgyzstan Som', | |
'LAK' => 'Laos Kip', | |
'LVL' => 'Latvia Lat', | |
'LBP' => 'Lebanon Pound', | |
'LRD' => 'Liberia Dollar', | |
'LTL' => 'Lithuania Litas', | |
'MKD' => 'Macedonia Denar', | |
'MYR' => 'Malaysia Ringgit', | |
'MUR' => 'Mauritius Rupee', | |
'MXN' => 'Mexico Peso', | |
'MNT' => 'Mongolia Tughrik', | |
'MZN' => 'Mozambique Metical', | |
'NAD' => 'Namibia Dollar', | |
'NPR' => 'Nepal Rupee', | |
'ANG' => 'Netherlands Antilles Guilder', | |
'NZD' => 'New Zealand Dollar', | |
'NIO' => 'Nicaragua Cordoba', | |
'NGN' => 'Nigeria Naira', | |
'NOK' => 'Norway Krone', | |
'OMR' => 'Oman Rial', | |
'PKR' => 'Pakistan Rupee', | |
'PAB' => 'Panama Balboa', | |
'PYG' => 'Paraguay Guarani', | |
'PEN' => 'Peru Nuevo Sol', | |
'PHP' => 'Philippines Peso', | |
'PLN' => 'Poland Zloty', | |
'QAR' => 'Qatar Riyal', | |
'RON' => 'Romania New Leu', | |
'RUB' => 'Russia Ruble', | |
'SHP' => 'Saint Helena Pound', | |
'SAR' => 'Saudi Arabia Riyal', | |
'RSD' => 'Serbia Dinar', | |
'SCR' => 'Seychelles Rupee', | |
'SGD' => 'Singapore Dollar', | |
'SBD' => 'Solomon Islands Dollar', | |
'SOS' => 'Somalia Shilling', | |
'ZAR' => 'South Africa Rand', | |
'LKR' => 'Sri Lanka Rupee', | |
'SEK' => 'Sweden Krona', | |
'CHF' => 'Switzerland Franc', | |
'SRD' => 'Suriname Dollar', | |
'SYP' => 'Syria Pound', | |
'TWD' => 'Taiwan New Dollar', | |
'THB' => 'Thailand Baht', | |
'TTD' => 'Trinidad and Tobago Dollar', | |
'TRY' => 'Turkey Lira', | |
'TRL' => 'Turkey Lira', | |
'TVD' => 'Tuvalu Dollar', | |
'UAH' => 'Ukraine Hryvna', | |
'GBP' => 'United Kingdom Pound', | |
'USD' => 'United States Dollar', | |
'UYU' => 'Uruguay Peso', | |
'UZS' => 'Uzbekistan Som', | |
'VEF' => 'Venezuela Bolivar', | |
'VND' => 'Viet Nam Dong', | |
'YER' => 'Yemen Rial', | |
'ZWD' => 'Zimbabwe Dollar' | |
); |
may be useful who need a currency symbol
<?php
// function get currency symbol by currency code
function get_currency_symbol($currency = '')
{
$symbols = array(
'AED' => 'د.إ', // ?
'AFN' => 'Af',
'ALL' => 'Lek',
'AMD' => '֏',
'ANG' => 'ƒ',
'AOA' => 'Kz', // ?
'ARS' => '$',
'AUD' => '$',
'AWG' => 'ƒ',
'AZN' => 'ман',
'BAM' => 'KM',
'BBD' => '$',
'BDT' => '৳', // ?
'BGN' => 'лв',
'BHD' => '.د.ب', // ?
'BIF' => 'FBu', // ?
'BMD' => '$',
'BND' => '$',
'BOB' => '$b',
'BRL' => 'R$',
'BSD' => '$',
'BTC' => '฿',
'BTN' => 'Nu.', // ?
'BWP' => 'P',
'BYR' => 'p.',
'BYN' => 'Br',
'BZD' => 'BZ$',
'CAD' => '$',
'CDF' => 'FC',
'CHF' => 'CHF',
'CLF' => '', // ?
'CLP' => '$',
'CNY' => '¥',
'COP' => '$',
'CRC' => '₡',
'CUC' => '⃌',
'CUP' => '⃌',
'CVE' => '$', // ?
'CZK' => 'Kč',
'DJF' => 'Fdj', // ?
'DKK' => 'kr',
'DOP' => 'RD$',
'DZD' => 'دج', // ?
'EGP' => '£',
'ERN' => 'Nfk', // ?
'ETB' => 'Br',
'EUR' => '€',
'FJD' => '$',
'FKP' => '£',
'GBP' => '£',
'GEL' => 'ლ', // ?
'GGP' => '£',
'GHS' => '¢',
'GIP' => '£',
'GMD' => 'D', // ?
'GNF' => 'FG', // ?
'GTQ' => 'Q',
'GYD' => '$',
'HKD' => '$',
'HNL' => 'L',
'HRK' => 'kn',
'HTG' => 'G', // ?
'PKE' => '$',
'HUF' => 'Ft',
'IDR' => 'Rp',
'ILS' => '₪',
'IMP' => '£',
'INR' => '₹',
'IQD' => 'ع.د', // ?
'IRR' => '﷼',
'IRT' => '﷼',
'ISK' => 'kr',
'JEP' => '£',
'JMD' => 'J$',
'JOD' => 'JD', // ?
'JPY' => '¥',
'KES' => 'KSh', // ?
'KGS' => 'лв',
'KHR' => '៛',
'KMF' => 'CF', // ?
'KPW' => '₩',
'KRW' => '₩',
'KWD' => 'د.ك', // ?
'KYD' => '$',
'KZT' => 'лв',
'LAK' => '₭',
'LBP' => '£',
'LKR' => '₨',
'LRD' => '$',
'LSL' => 'L', // ?
'LTL' => 'Lt',
'LVL' => 'Ls',
'LYD' => 'ل.د', // ?
'MAD' => 'د.م.', //?
'MDL' => 'L',
'MGA' => 'Ar', // ?
'MKD' => 'ден',
'MMK' => 'K',
'MNT' => '₮',
'MOP' => 'MOP$', // ?
'MRO' => 'UM', // ?
'MUR' => '₨', // ?
'MVR' => '.ރ', // ?
'MWK' => 'MK',
'MXN' => '$',
'MYR' => 'RM',
'MZN' => 'MT',
'NAD' => '$',
'NGN' => '₦',
'NIO' => 'C$',
'NOK' => 'kr',
'NPR' => '₨',
'NZD' => '$',
'OMR' => '﷼',
'PAB' => 'B/.',
'PEN' => 'S/.',
'PGK' => 'K', // ?
'PHP' => '₱',
'PKR' => '₨',
'PLN' => 'zł',
'PYG' => 'Gs',
'QAR' => '﷼',
'RON' => 'lei',
'RSD' => 'Дин.',
'RUB' => 'руб',
'RWF' => 'ر.س',
'SAR' => '﷼',
'SBD' => '$',
'SCR' => '₨',
'SDG' => '£', // ?
'SEK' => 'kr',
'SGD' => '$',
'SHP' => '£',
'SLL' => 'Le', // ?
'SOS' => 'S',
'SPL' => '£',
'SRD' => '$',
'STD' => 'Db', // ?
'SVC' => '$',
'SYP' => '£',
'SZL' => 'L', // ?
'THB' => '฿',
'TJS' => 'TJS', // ? TJS (guess)
'TMT' => 'm',
'TND' => 'د.ت',
'TOP' => 'T$',
'TRY' => '₤', // New Turkey Lira (old symbol used)
'TTD' => '$',
'TVD' => '$',
'TWD' => 'NT$',
'TZS' => '',
'UAH' => '₴',
'UGX' => 'USh',
'USD' => '$',
'UYU' => '$U',
'UZS' => 'лв',
'VEF' => 'Bs',
'VND' => '₫',
'VUV' => 'VT',
'WST' => 'WS$',
'XAF' => 'FCFA',
'XCD' => '$',
'XDR' => '',
'XOF' => '',
'XPF' => 'F',
'ZAR' => 'R',
'ZMW' => 'ZK',
);
if (isset($symbols[$currency])) {
return $symbols[$currency];
}
return $currency;
}
echo get_currency_symbol('USD');
?>
Hey awesome work, I have a dumb question, how can we display the symbols? do we have a specific php function for this?
Edited: I discovered that is an html entity, so I use this website to preview the display https://html.onlineviewer.net/
The function
Hey awesome work, I have a dumb question, how can we display the symbols? do we have a specific php function for this?
The function rajaishtiaq6 shared is written in PHP though, you should try it out.
This is more better
function currencyList(?string $code = null, bool $decode_html_entity = true): array|null
{
$currencies = [
['code' => 'AFN', 'countries' => ['Afghanistan'], 'name' => 'Afghanistan Afghani', 'symbol' => '؋'],
['code' => 'ARS', 'countries' => ['Argentina'], 'name' => 'Argentine Peso', 'symbol' => '$'],
['code' => 'AWG', 'countries' => ['Aruba'], 'name' => 'Aruban florin', 'symbol' => 'ƒ'],
['code' => 'AUD', 'countries' => ['Australia'], 'name' => 'Australian Dollar', 'symbol' => 'A$'],
['code' => 'AZN', 'countries' => ['Azerbaijan'], 'name' => 'Azerbaijani Manat', 'symbol' => '₼'],
['code' => 'BSD', 'countries' => ['The Bahamas'], 'name' => 'Bahamas Dollar', 'symbol' => 'B$'],
['code' => 'BBD', 'countries' => ['Barbados'], 'name' => 'Barbados Dollar', 'symbol' => 'Bds$'],
['code' => 'BDT', 'countries' => ['People\'s Republic of Bangladesh'], 'name' => 'Bangladeshi taka', 'symbol' => '৳'],
['code' => 'BYN', 'countries' => ['Belarus'], 'name' => 'Belarus Ruble', 'symbol' => 'Br'],
['code' => 'BZD', 'countries' => ['Belize'], 'name' => 'Belize Dollar', 'symbol' => 'BZ$'],
['code' => 'BMD', 'countries' => ['British Overseas Territory of Bermuda'], 'name' => 'Bermudian Dollar', 'symbol' => 'BD$'],
['code' => 'BOP', 'countries' => ['Bolivia'], 'name' => 'Boliviano', 'symbol' => 'Bs'],
['code' => 'BAM', 'countries' => ['Bosnia', 'Herzegovina'], 'name' => 'Bosnia-Herzegovina Convertible Marka', 'symbol' => 'KM'],
['code' => 'BWP', 'countries' => ['Botswana'], 'name' => 'Botswana pula', 'symbol' => 'P'],
['code' => 'BGN', 'countries' => ['Bulgaria'], 'name' => 'Bulgarian lev', 'symbol' => 'лв'],
['code' => 'BRL', 'countries' => ['Brazil'], 'name' => 'Brazilian real', 'symbol' => 'R$'],
['code' => 'BND', 'countries' => ['Sultanate of Brunei'], 'name' => 'Brunei dollar', 'symbol' => 'B$'],
['code' => 'KHR', 'countries' => ['Cambodia'], 'name' => 'Cambodian riel', 'symbol' => '៛'],
['code' => 'CAD', 'countries' => ['Canada'], 'name' => 'Canadian dollar', 'symbol' => 'C$'],
['code' => 'KYD', 'countries' => ['Cayman Islands'], 'name' => 'Cayman Islands dollar', 'symbol' => '$'],
['code' => 'CLP', 'countries' => ['Chile'], 'name' => 'Chilean peso', 'symbol' => '$'],
['code' => 'CNY', 'countries' => ['China'], 'name' => 'Chinese Yuan Renminbi', 'symbol' => '¥'],
['code' => 'COP', 'countries' => ['Colombia'], 'name' => 'Colombian peso', 'symbol' => '$'],
['code' => 'CRC', 'countries' => ['Costa Rica'], 'name' => 'Costa Rican colón', 'symbol' => '₡'],
['code' => 'HRK', 'countries' => ['Croatia'], 'name' => 'Croatian kuna', 'symbol' => 'kn'],
['code' => 'CUP', 'countries' => ['Cuba'], 'name' => 'Cuban peso', 'symbol' => '₱'],
['code' => 'CZK', 'countries' => ['Czech Republic'], 'name' => 'Czech koruna', 'symbol' => 'Kč'],
['code' => 'DKK', 'countries' => ['Denmark', 'Greenland', 'The Faroe Islands'], 'name' => 'Danish krone', 'symbol' => 'kr'],
['code' => 'DOP', 'countries' => ['Dominican Republic'], 'name' => 'Dominican peso', 'symbol' => 'RD$'],
['code' => 'XCD', 'countries' => ['Antigua and Barbuda', 'Commonwealth of Dominica', 'Grenada', 'Montserrat', 'St. Kitts and Nevis', 'Saint Lucia and St. Vincent', 'The Grenadines'], 'name' => 'Eastern Caribbean dollar', 'symbol'=> '$'],
['code' => 'EGP', 'countries' => ['Egypt'], 'name' => 'Egyptian pound', 'symbol' => '£'],
['code' => 'SVC', 'countries' => ['El Salvador'], 'name' => 'Salvadoran colón', 'symbol' => '$'],
['code' => 'EEK', 'countries' => ['Estonia'], 'name' => 'Estonian kroon', 'symbol' => 'Kr'],
['code' => 'EUR', 'countries' => ['European Union', 'Italy', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece', 'Hungary', 'Ireland', 'Latvia', 'Lithuania', 'Luxembourg', 'Malta', 'Netherlands', 'Poland', 'Portugal', 'Romania', 'Slovakia', 'Slovenia', 'Spain', 'Sweden'], 'name' => 'Euro', 'symbol' => '€'],
['code' => 'FKP', 'countries' => ['Falkland Islands'], 'name' => 'Falkland Islands (Malvinas) Pound', 'symbol' => 'FK£'],
['code' => 'FJD', 'countries' => ['Fiji'], 'name' => 'Fijian dollar', 'symbol' => 'FJ$'],
['code' => 'GHC', 'countries' => ['Ghana'], 'name' => 'Ghanaian cedi', 'symbol'=> 'GH¢'],
['code' => 'GIP', 'countries' => ['Gibraltar'], 'name' => 'Gibraltar pound', 'symbol' => '£'],
['code' => 'GTQ', 'countries' => ['Guatemala'], 'name' => 'Guatemalan quetzal', 'symbol' => 'Q'],
['code' => 'GGP', 'countries' => ['Guernsey'], 'name' => 'Guernsey pound', 'symbol' => 'Q'],
['code' => 'GYD', 'countries' => ['Guyana'], 'name' => 'Guyanese dollar', 'symbol' => 'GY$'],
['code' => 'HNL', 'countries' => ['Honduras'], 'name' => 'Honduran lempira', 'symbol' => 'L'],
['code' => 'HKD', 'countries' => ['Hong Kong'], 'name' => 'Hong Kong dollar', 'symbol' => 'HK$'],
['code' => 'HUF', 'countries' => ['Hungary'], 'name' => 'Hungarian forint', 'symbol' => 'Ft'],
['code' => 'ISK', 'countries' => ['Iceland'], 'name' => 'Icelandic króna', 'symbol' => 'íkr'],
['code' => 'INR', 'countries' => ['India'], 'name' => 'Indian rupee', 'symbol' => '₹'],
['code' => 'IDR', 'countries' => ['Indonesia'], 'name' => 'Indonesian rupiah', 'symbol' => 'Rp'],
['code' => 'IRR', 'countries' => ['Iran'], 'name' => 'Iranian rial', 'symbol' => '﷼'],
['code' => 'IMP', 'countries' => ['Isle of Man'], 'name' => 'Manx pound', 'symbol' => '£'],
['code' => 'ILS', 'countries' => ['Israel', 'Palestinian territories of the West Bank', 'The Gaza Strip'], 'name' => 'Israeli Shekel', 'symbol' => '₪'],
['code' => 'JMD', 'countries' => ['Jamaica'], 'name' => 'Jamaican dollar', 'symbol' => 'J$'],
['code' => 'JPY', 'countries' => ['Japan'], 'name' => 'Japanese yen', 'symbol' => '¥'],
['code' => 'JEP', 'countries' => ['Jersey'], 'name' => 'Jersey pound', 'symbol' => '£'],
['code' => 'KZT', 'countries' => ['Kazakhstan'], 'name' => 'Kazakhstani tenge', 'symbol' => '₸'],
['code' => 'KPW', 'countries' => ['North Korea'], 'name' => 'North Korean won', 'symbol' => '₩'],
['code' => 'KPW', 'countries' => ['South Korea'], 'name' => 'South Korean won', 'symbol' => '₩'],
['code' => 'KGS', 'countries' => ['Kyrgyz Republic'], 'name' => 'Kyrgyzstani som', 'symbol' => 'лв'],
['code' => 'LAK', 'countries' => ['Laos'], 'name' => 'Lao kip', 'symbol' => '₭'],
['code' => 'LAK', 'countries' => ['Laos'], 'name' => 'Latvian lats', 'symbol' => '€'],
['code' => 'LVL', 'countries' => ['Laos'], 'name' => 'Latvian lats', 'symbol' => '€'],
['code' => 'LBP', 'countries' => ['Lebanon'], 'name' => 'Lebanese pound', 'symbol' => 'L£'],
['code' => 'LRD', 'countries' => ['Liberia'], 'name' => 'Liberian dollar', 'symbol' => 'LD$'],
['code' => 'LTL', 'countries' => ['Lithuania'], 'name' => 'Lithuanian litas', 'symbol' => '€'],
['code' => 'MKD', 'countries' => ['North Macedonia'], 'name' => 'Macedonian denar', 'symbol' => 'ден'],
['code' => 'MYR', 'countries' => ['Malaysia'], 'name' => 'Malaysian ringgit', 'symbol' => 'RM'],
['code' => 'MUR', 'countries' => ['Mauritius'], 'name' => 'Mauritian rupee', 'symbol' => 'Rs'],
['code' => 'MXN', 'countries' => ['Mexico'], 'name' => 'Mexican peso', 'symbol' => 'Mex$'],
['code' => 'MNT', 'countries' => ['Mongolia'], 'name' => 'Mongolian tögrög', 'symbol' => '₮'],
['code' => 'MZN', 'countries' => ['Mozambique'], 'name' => 'Mozambican metical', 'symbol' => 'MT'],
['code' => 'NAD', 'countries' => ['Namibia'], 'name' => 'Namibian dollar', 'symbol' => 'N$'],
['code' => 'NPR', 'countries' => ['Federal Democratic Republic of Nepal'], 'name' => 'Nepalese rupee', 'symbol'=> 'Rs.'],
['code' => 'ANG', 'countries' => ['Curaçao', 'Sint Maarten'], 'name' => 'Netherlands Antillean guilder', 'symbol' => 'ƒ'],
['code' => 'NZD', 'countries' => ['New Zealand', 'The Cook Islands', 'Niue', 'The Ross Dependency', 'Tokelau', 'The Pitcairn Islands'], 'name' => 'New Zealand Dollar', 'symbol' => '$'],
['code' => 'NIO', 'countries' => ['Nicaragua'], 'name' => 'Nicaraguan córdoba', 'symbol' => 'C$'],
['code' => 'NGN', 'countries' => ['Nigeria'], 'name'=> 'Nigerian Naira', 'symbol' => '₦'],
['code' => 'NOK', 'countries' => ['Norway and its dependent territories'], 'name' => 'Norwegian krone', 'symbol'=> 'kr'],
['code' => 'OMR', 'countries' => ['Oman'], 'name' => 'Omani rial', 'symbol' => '﷼'],
['code' => 'PKR', 'countries' => ['Pakistan'], 'name' => 'Pakistani rupee', 'symbol' => 'Rs'],
['code' => 'PAB', 'countries' => ['Panama'], 'name' => 'Panamanian balboa', 'symbol' => 'B/.'],
['code' => 'PYG', 'countries' => ['Paraguay'], 'name' => 'Paraguayan Guaraní', 'symbol' => '₲'],
['code' => 'PEN', 'countries' => ['Peru'], 'name' => 'Sol', 'symbol' => 'S/.'],
['code' => 'PHP', 'countries' => ['Philippines'], 'name' => 'Philippine peso', 'symbol' => '₱'],
['code' => 'PLN', 'countries' => ['Poland'], 'name' => 'Polish złoty', 'symbol' => 'zł'],
['code' => 'QAR', 'countries' => ['State of Qatar'], 'name' => 'Qatari Riyal', 'symbol' => '﷼'],
['code' => 'RON', 'countries' => ['Romania'], 'name' => 'Romanian leu (Leu românesc)', 'symbol' => 'L'],
['code' => 'RUB', 'countries' => ['Russian Federation', 'Abkhazia and South Ossetia', 'Donetsk and Luhansk'], 'name' => 'Russian ruble', 'symbol' => '₽'],
['code' => 'SHP', 'countries' => ['Saint Helena', 'Ascension', 'Tristan da Cunha'], 'name' => 'Saint Helena pound', 'symbol' => '£'],
['code' => 'SAR', 'countries' => ['Saudi Arabia'], 'name' => 'Saudi riyal', 'symbol' => '﷼'],
['code' => 'RSD', 'countries' => ['Serbia'], 'name' => 'Serbian dinar', 'symbol' => 'din'],
['code' => 'SCR', 'countries' => ['Seychelles'], 'name' => 'Seychellois rupee', 'symbol' => 'Rs'],
['code' => 'SGD', 'countries' => ['Singapore'], 'name' => 'Singapore dollar', 'symbol' => 'S$'],
['code' => 'SBD', 'countries' => ['Solomon Islands'], 'name' => 'Solomon Islands dollar', 'symbol' => 'SI$'],
['code' => 'SOS', 'countries' => ['Somalia'], 'name' => 'Somali shilling', 'symbol' => 'Sh.So'],
['code' => 'ZAR', 'countries' => ['South Africa'], 'name' => 'South African rand', 'symbol' => 'R'],
['code' => 'LKR', 'countries' => ['Sri Lanka'], 'name' => 'Sri Lankan rupee', 'symbol' => 'Rs'],
['code' => 'SEK', 'countries' => ['Sweden'], 'name' => 'Swedish krona', 'symbol' => 'kr'],
['code' => 'CHF', 'countries' => ['Switzerland'], 'name' => 'Swiss franc', 'symbol' => 'CHf'],
['code' => 'SRD', 'countries' => ['Suriname'], 'name' => 'Suriname Dollar', 'symbol' => 'Sr$'],
['code' => 'SYP', 'countries' => ['Syria'], 'name' => 'Syrian pound', 'symbol' => '£S'],
['code' => 'TWD', 'countries' => ['Taiwan'], 'name' => 'New Taiwan dollar', 'symbol' => 'NT$'],
['code' => 'THB', 'countries' => ['Thailand'], 'name' => 'Thai baht', 'symbol' => '฿'],
['code' => 'TTD', 'countries' => ['Trinidad', 'Tobago'], 'name' => 'Trinidad and Tobago dollar', 'symbol' => 'TT$'],
['code' => 'TRY', 'countries' => ['Turkey', 'Turkish Republic of Northern Cyprus'], 'name' => 'Turkey Lira', 'symbol' => '₺'],
['code' => 'TVD', 'countries' => ['Tuvalu'], 'name' => 'Tuvaluan dollar', 'symbol' => 'TV$'],
['code' => 'UAH', 'countries' => ['Ukraine'], 'name' => 'Ukrainian hryvnia', 'symbol' => '₴'],
['code' => 'GBP', 'countries' => ['United Kingdom', 'Jersey', 'Guernsey', 'The Isle of Man', 'Gibraltar', 'South Georgia', 'The South Sandwich Islands', 'The British Antarctic', 'Territory', 'Tristan da Cunha'], 'name' => 'Pound sterling', 'symbol' => '£'],
['code' => 'UGX', 'countries' => ['Uganda'], 'name' => 'Ugandan shilling', 'symbol' => 'USh'],
['code' => 'USD', 'countries' => ['United States'], 'name' => 'United States dollar', 'symbol' => '$'],
['code' => 'UYU', 'countries' => ['Uruguayan'], 'name' => 'Peso Uruguayolar', 'symbol' => '$U'],
['code' => 'UZS', 'countries' => ['Uzbekistan'], 'name' => 'Uzbekistani soʻm', 'symbol' => 'лв'],
['code' => 'VEF', 'countries' => ['Venezuela'], 'name' => 'Venezuelan bolívar', 'symbol' => 'Bs'],
['code' => 'VND', 'countries' => ['Vietnam'], 'name' => 'Vietnamese dong (Đồng)', 'symbol' => '₫'],
['code' => 'VND', 'countries' => ['Yemen'], 'name' => 'Yemeni rial', 'symbol' => '﷼'],
['code' => 'ZWD', 'countries' => ['Zimbabwe'], 'name' => 'Zimbabwean dollar', 'symbol' => 'Z$'],
];
if (true === $decode_html_entity) {
$currencies = array_map(function ($each_cur) {
$each_cur['symbol'] = html_entity_decode($each_cur['symbol']);
return $each_cur;
}, $currencies);
}
if (!is_null($code)) {
return array_values(array_filter($currencies, fn ($c) => strtolower($c['code']) === strtolower($code)))[0] ?? null;
}
return $currencies;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for the array @SimonKane, needed to use it in JS and your format was just what I needed.