Skip to content

Instantly share code, notes, and snippets.

@champsupertramp
Forked from MindaugasR/currency_list
Last active July 15, 2024 14:06
Show Gist options
  • Save champsupertramp/95493faa7ba12b61bf6e to your computer and use it in GitHub Desktop.
Save champsupertramp/95493faa7ba12b61bf6e to your computer and use it in GitHub Desktop.
World Currency list in PHP Array
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'
);
@devmoosun
Copy link

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.

@iamprincesly
Copy link

iamprincesly commented Jan 27, 2024

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