Skip to content

Instantly share code, notes, and snippets.

@grexlort
Last active June 1, 2024 01:45
Show Gist options
  • Save grexlort/00cd35c9e6f6e5d2c6f2 to your computer and use it in GitHub Desktop.
Save grexlort/00cd35c9e6f6e5d2c6f2 to your computer and use it in GitHub Desktop.
List of phone prefix codes with country in PHP array format prefix => country +xxx
// data from https://gist.github.com/andyj/7108917
$array = [
'44' => 'UK (+44)',
'1' => 'USA (+1)',
'213' => 'Algeria (+213)',
'376' => 'Andorra (+376)',
'244' => 'Angola (+244)',
'1264' => 'Anguilla (+1264)',
'1268' => 'Antigua & Barbuda (+1268)',
'54' => 'Argentina (+54)',
'374' => 'Armenia (+374)',
'297' => 'Aruba (+297)',
'61' => 'Australia (+61)',
'43' => 'Austria (+43)',
'994' => 'Azerbaijan (+994)',
'1242' => 'Bahamas (+1242)',
'973' => 'Bahrain (+973)',
'880' => 'Bangladesh (+880)',
'1246' => 'Barbados (+1246)',
'375' => 'Belarus (+375)',
'32' => 'Belgium (+32)',
'501' => 'Belize (+501)',
'229' => 'Benin (+229)',
'1441' => 'Bermuda (+1441)',
'975' => 'Bhutan (+975)',
'591' => 'Bolivia (+591)',
'387' => 'Bosnia Herzegovina (+387)',
'267' => 'Botswana (+267)',
'55' => 'Brazil (+55)',
'673' => 'Brunei (+673)',
'359' => 'Bulgaria (+359)',
'226' => 'Burkina Faso (+226)',
'257' => 'Burundi (+257)',
'855' => 'Cambodia (+855)',
'237' => 'Cameroon (+237)',
'1' => 'Canada (+1)',
'238' => 'Cape Verde Islands (+238)',
'1345' => 'Cayman Islands (+1345)',
'236' => 'Central African Republic (+236)',
'56' => 'Chile (+56)',
'86' => 'China (+86)',
'57' => 'Colombia (+57)',
'269' => 'Comoros (+269)',
'242' => 'Congo (+242)',
'682' => 'Cook Islands (+682)',
'506' => 'Costa Rica (+506)',
'385' => 'Croatia (+385)',
'53' => 'Cuba (+53)',
'90392' => 'Cyprus North (+90392)',
'357' => 'Cyprus South (+357)',
'42' => 'Czech Republic (+42)',
'45' => 'Denmark (+45)',
'253' => 'Djibouti (+253)',
'1809' => 'Dominica (+1809)',
'1809' => 'Dominican Republic (+1809)',
'593' => 'Ecuador (+593)',
'20' => 'Egypt (+20)',
'503' => 'El Salvador (+503)',
'240' => 'Equatorial Guinea (+240)',
'291' => 'Eritrea (+291)',
'372' => 'Estonia (+372)',
'251' => 'Ethiopia (+251)',
'500' => 'Falkland Islands (+500)',
'298' => 'Faroe Islands (+298)',
'679' => 'Fiji (+679)',
'358' => 'Finland (+358)',
'33' => 'France (+33)',
'594' => 'French Guiana (+594)',
'689' => 'French Polynesia (+689)',
'241' => 'Gabon (+241)',
'220' => 'Gambia (+220)',
'7880' => 'Georgia (+7880)',
'49' => 'Germany (+49)',
'233' => 'Ghana (+233)',
'350' => 'Gibraltar (+350)',
'30' => 'Greece (+30)',
'299' => 'Greenland (+299)',
'1473' => 'Grenada (+1473)',
'590' => 'Guadeloupe (+590)',
'671' => 'Guam (+671)',
'502' => 'Guatemala (+502)',
'224' => 'Guinea (+224)',
'245' => 'Guinea - Bissau (+245)',
'592' => 'Guyana (+592)',
'509' => 'Haiti (+509)',
'504' => 'Honduras (+504)',
'852' => 'Hong Kong (+852)',
'36' => 'Hungary (+36)',
'354' => 'Iceland (+354)',
'91' => 'India (+91)',
'62' => 'Indonesia (+62)',
'98' => 'Iran (+98)',
'964' => 'Iraq (+964)',
'353' => 'Ireland (+353)',
'972' => 'Israel (+972)',
'39' => 'Italy (+39)',
'1876' => 'Jamaica (+1876)',
'81' => 'Japan (+81)',
'962' => 'Jordan (+962)',
'7' => 'Kazakhstan (+7)',
'254' => 'Kenya (+254)',
'686' => 'Kiribati (+686)',
'850' => 'Korea North (+850)',
'82' => 'Korea South (+82)',
'965' => 'Kuwait (+965)',
'996' => 'Kyrgyzstan (+996)',
'856' => 'Laos (+856)',
'371' => 'Latvia (+371)',
'961' => 'Lebanon (+961)',
'266' => 'Lesotho (+266)',
'231' => 'Liberia (+231)',
'218' => 'Libya (+218)',
'417' => 'Liechtenstein (+417)',
'370' => 'Lithuania (+370)',
'352' => 'Luxembourg (+352)',
'853' => 'Macao (+853)',
'389' => 'Macedonia (+389)',
'261' => 'Madagascar (+261)',
'265' => 'Malawi (+265)',
'60' => 'Malaysia (+60)',
'960' => 'Maldives (+960)',
'223' => 'Mali (+223)',
'356' => 'Malta (+356)',
'692' => 'Marshall Islands (+692)',
'596' => 'Martinique (+596)',
'222' => 'Mauritania (+222)',
'269' => 'Mayotte (+269)',
'52' => 'Mexico (+52)',
'691' => 'Micronesia (+691)',
'373' => 'Moldova (+373)',
'377' => 'Monaco (+377)',
'976' => 'Mongolia (+976)',
'1664' => 'Montserrat (+1664)',
'212' => 'Morocco (+212)',
'258' => 'Mozambique (+258)',
'95' => 'Myanmar (+95)',
'264' => 'Namibia (+264)',
'674' => 'Nauru (+674)',
'977' => 'Nepal (+977)',
'31' => 'Netherlands (+31)',
'687' => 'New Caledonia (+687)',
'64' => 'New Zealand (+64)',
'505' => 'Nicaragua (+505)',
'227' => 'Niger (+227)',
'234' => 'Nigeria (+234)',
'683' => 'Niue (+683)',
'672' => 'Norfolk Islands (+672)',
'670' => 'Northern Marianas (+670)',
'47' => 'Norway (+47)',
'968' => 'Oman (+968)',
'680' => 'Palau (+680)',
'507' => 'Panama (+507)',
'675' => 'Papua New Guinea (+675)',
'595' => 'Paraguay (+595)',
'51' => 'Peru (+51)',
'63' => 'Philippines (+63)',
'48' => 'Poland (+48)',
'351' => 'Portugal (+351)',
'1787' => 'Puerto Rico (+1787)',
'974' => 'Qatar (+974)',
'262' => 'Reunion (+262)',
'40' => 'Romania (+40)',
'7' => 'Russia (+7)',
'250' => 'Rwanda (+250)',
'378' => 'San Marino (+378)',
'239' => 'Sao Tome & Principe (+239)',
'966' => 'Saudi Arabia (+966)',
'221' => 'Senegal (+221)',
'381' => 'Serbia (+381)',
'248' => 'Seychelles (+248)',
'232' => 'Sierra Leone (+232)',
'65' => 'Singapore (+65)',
'421' => 'Slovak Republic (+421)',
'386' => 'Slovenia (+386)',
'677' => 'Solomon Islands (+677)',
'252' => 'Somalia (+252)',
'27' => 'South Africa (+27)',
'34' => 'Spain (+34)',
'94' => 'Sri Lanka (+94)',
'290' => 'St. Helena (+290)',
'1869' => 'St. Kitts (+1869)',
'1758' => 'St. Lucia (+1758)',
'249' => 'Sudan (+249)',
'597' => 'Suriname (+597)',
'268' => 'Swaziland (+268)',
'46' => 'Sweden (+46)',
'41' => 'Switzerland (+41)',
'963' => 'Syria (+963)',
'886' => 'Taiwan (+886)',
'7' => 'Tajikstan (+7)',
'66' => 'Thailand (+66)',
'228' => 'Togo (+228)',
'676' => 'Tonga (+676)',
'1868' => 'Trinidad & Tobago (+1868)',
'216' => 'Tunisia (+216)',
'90' => 'Turkey (+90)',
'7' => 'Turkmenistan (+7)',
'993' => 'Turkmenistan (+993)',
'1649' => 'Turks & Caicos Islands (+1649)',
'688' => 'Tuvalu (+688)',
'256' => 'Uganda (+256)',
'380' => 'Ukraine (+380)',
'971' => 'United Arab Emirates (+971)',
'598' => 'Uruguay (+598)',
'7' => 'Uzbekistan (+7)',
'678' => 'Vanuatu (+678)',
'379' => 'Vatican City (+379)',
'58' => 'Venezuela (+58)',
'84' => 'Vietnam (+84)',
'84' => 'Virgin Islands - British (+1284)',
'84' => 'Virgin Islands - US (+1340)',
'681' => 'Wallis & Futuna (+681)',
'969' => 'Yemen (North)(+969)',
'967' => 'Yemen (South)(+967)',
'260' => 'Zambia (+260)',
'263' => 'Zimbabwe (+263)',
];
@darklord1807
Copy link

To add Mauritius +230

@ncla
Copy link

ncla commented May 7, 2021

I would not use hardcoded lists but instead use this package which is based on a Google phone number package: https://github.com/giggsey/libphonenumber-for-php

And then you do something like this to get dial code and region code.

use libphonenumber\PhoneNumberUtil;
use libphonenumber\ShortNumberInfo;

$shortNumberInfoInstance = ShortNumberInfo::getInstance();
$phoneNumberUtilInstance = PhoneNumberUtil::getInstance();

return array_map(function ($region) use ($phoneNumberUtilInstance) {
    return [
        'region' => $region,
        'code' => $phoneNumberUtilInstance->getCountryCodeForRegion($region)
    ];
}, $shortNumberInfoInstance->getSupportedRegions());

@Ajax30
Copy link

Ajax30 commented Jan 21, 2022

The list of all countries has 249 items. This one has 205. How do I get a list of dial codes by country, like this:

$dial_codes= array (
'AF' => '',
'AX' => '',
'AD' => '+376',
'DZ' => '+213'
)

@frenadeveloper
Copy link

frenadeveloper commented Oct 14, 2022

export default [
    {country: "UK", code: "44" },
    {country: "USA", code: "1" },
    {country: "Algeria", code: "213" },
    {country: "Andorra", code: "376" },
    {country: "Angola", code: "244" },
    {country: "Anguilla", code: "1264" },
    {country: "Antigua & Barbuda", code: "1268" },
    {country: "Argentina", code: "54" },
    {country: "Armenia", code: "374" },
    {country: "Aruba", code: "297" },
    {country: "Australia", code: "61" },
    {country: "Austria", code: "43" },
    {country: "Azerbaijan", code: "994" },
    {country: "Bahamas", code: "1242" },
    {country: "Bahrain", code: "973" },
    {country: "Bangladesh", code: "880" },
    {country: "Barbados", code: "1246" },
    {country: "Belarus", code: "375" },
    {country: "Belgium", code: "32" },
    {country: "Belize", code: "501" },
    {country: "Benin", code: "229" },
    {country: "Bermuda", code: "1441" },
    {country: "Bhutan", code: "975" },
    {country: "Bolivia", code: "591" },
    {country: "Bosnia Herzegovina", code: "387" },
    {country: "Botswana", code: "267" },
    {country: "Brazil", code: "55" },
    {country: "Brunei", code: "673" },
    {country: "Bulgaria", code: "359" },
    {country: "Burkina Faso", code: "226" },
    {country: "Burundi", code: "257" },
    {country: "Cambodia", code: "855" },
    {country: "Cameroon", code: "237" },
    {country: "Canada", code: "1" },
    {country: "Cape Verde Islands", code: "238" },
    {country: "Cayman Islands", code: "1345" },
    {country: "Central African Republic", code: "236" },
    {country: "Chile", code: "56" },
    {country: "China", code: "86" },
    {country: "Colombia", code: "57" },
    {country: "Comoros", code: "269" },
    {country: "Congo", code: "242" },
    {country: "Cook Islands", code: "682" },
    {country: "Costa Rica", code: "506" },
    {country: "Croatia", code: "385" },
    {country: "Cuba", code: "53" },
    {country: "Cyprus North", code: "90392" },
    {country: "Cyprus South", code: "357" },
    {country: "Czech Republic", code: "42" },
    {country: "Denmark", code: "45" },
    {country: "Djibouti", code: "253" },
    {country: "Dominica", code: "1809" },
    {country: "Dominican Republic", code: "1809" },
    {country: "Ecuador", code: "593" },
    {country: "Egypt", code: "20" },
    {country: "El Salvador", code: "503" },
    {country: "Equatorial Guinea", code: "240" },
    {country: "Eritrea", code: "291" },
    {country: "Estonia", code: "372" },
    {country: "Ethiopia", code: "251" },
    {country: "Falkland Islands", code: "500" },
    {country: "Faroe Islands", code: "298" },
    {country: "Fiji", code: "679" },
    {country: "Finland", code: "358" },
    {country: "France", code: "33" },
    {country: "French Guiana", code: "594" },
    {country: "French Polynesia", code: "689" },
    {country: "Gabon", code: "241" },
    {country: "Gambia", code: "220" },
    {country: "Georgia", code: "7880" },
    {country: "Germany", code: "49" },
    {country: "Ghana", code: "233" },
    {country: "Gibraltar", code: "350" },
    {country: "Greece", code: "30" },
    {country: "Greenland", code: "299" },
    {country: "Grenada", code: "1473" },
    {country: "Guadeloupe", code: "590" },
    {country: "Guam", code: "671" },
    {country: "Guatemala", code: "502" },
    {country: "Guinea", code: "224" },
    {country: "Guinea - Bissau", code: "245" },
    {country: "Guyana", code: "592" },
    {country: "Haiti", code: "509" },
    {country: "Honduras", code: "504" },
    {country: "Hong Kong", code: "852" },
    {country: "Hungary", code: "36" },
    {country: "Iceland", code: "354" },
    {country: "India", code: "91" },
    {country: "Indonesia", code: "62" },
    {country: "Iran", code: "98" },
    {country: "Iraq", code: "964" },
    {country: "Ireland", code: "353" },
    {country: "Israel", code: "972" },
    {country: "Italy", code: "39" },
    {country: "Jamaica", code: "1876" },
    {country: "Japan", code: "81" },
    {country: "Jordan", code: "962" },
    {country: "Kazakhstan", code: "7" },
    {country: "Kenya", code: "254" },
    {country: "Kiribati", code: "686" },
    {country: "Korea North", code: "850" },
    {country: "Korea South", code: "82" },
    {country: "Kuwait", code: "965" },
    {country: "Kyrgyzstan", code: "996" },
    {country: "Laos", code: "856" },
    {country: "Latvia", code: "371" },
    {country: "Lebanon", code: "961" },
    {country: "Lesotho", code: "266" },
    {country: "Liberia", code: "231" },
    {country: "Libya", code: "218" },
    {country: "Liechtenstein", code: "417" },
    {country: "Lithuania", code: "370" },
    {country: "Luxembourg", code: "352" },
    {country: "Macao", code: "853" },
    {country: "Macedonia", code: "389" },
    {country: "Madagascar", code: "261" },
    {country: "Malawi", code: "265" },
    {country: "Malaysia", code: "60" },
    {country: "Maldives", code: "960" },
    {country: "Mali", code: "223" },
    {country: "Malta", code: "356" },
    {country: "Marshall Islands", code: "692" },
    {country: "Martinique", code: "596" },
    {country: "Mauritania", code: "222" },
    {country: "Mayotte", code: "269" },
    {country: "Mexico", code: "52" },
    {country: "Micronesia", code: "691" },
    {country: "Moldova", code: "373" },
    {country: "Monaco", code: "377" },
    {country: "Mongolia", code: "976" },
    {country: "Montserrat", code: "1664" },
    {country: "Morocco", code: "212" },
    {country: "Mozambique", code: "258" },
    {country: "Myanmar", code: "95" },
    {country: "Namibia", code: "264" },
    {country: "Nauru", code: "674" },
    {country: "Nepal", code: "977" },
    {country: "Netherlands", code: "31" },
    {country: "New Caledonia", code: "687" },
    {country: "New Zealand", code: "64" },
    {country: "Nicaragua", code: "505" },
    {country: "Niger", code: "227" },
    {country: "Nigeria", code: "234" },
    {country: "Niue", code: "683" },
    {country: "Norfolk Islands", code: "672" },
    {country: "Northern Marianas", code: "670" },
    {country: "Norway", code: "47" },
    {country: "Oman", code: "968" },
    {country: "Palau", code: "680" },
    {country: "Panama", code: "507" },
    {country: "Papua New Guinea", code: "675" },
    {country: "Paraguay", code: "595" },
    {country: "Peru", code: "51" },
    {country: "Philippines", code: "63" },
    {country: "Poland", code: "48" },
    {country: "Portugal", code: "351" },
    {country: "Puerto Rico", code: "1787" },
    {country: "Qatar", code: "974" },
    {country: "Reunion", code: "262" },
    {country: "Romania", code: "40" },
    {country: "Russia", code: "7" },
    {country: "Rwanda", code: "250" },
    {country: "San Marino", code: "378" },
    {country: "Sao Tome & Principe", code: "239" },
    {country: "Saudi Arabia", code: "966" },
    {country: "Senegal", code: "221" },
    {country: "Serbia", code: "381" },
    {country: "Seychelles", code: "248" },
    {country: "Sierra Leone", code: "232" },
    {country: "Singapore", code: "65" },
    {country: "Slovak Republic", code: "421" },
    {country: "Slovenia", code: "386" },
    {country: "Solomon Islands", code: "677" },
    {country: "Somalia", code: "252" },
    {country: "South Africa", code: "27" },
    {country: "Spain", code: "34" },
    {country: "Sri Lanka", code: "94" },
    {country: "St. Helena", code: "290" },
    {country: "St. Kitts", code: "1869" },
    {country: "St. Lucia", code: "1758" },
    {country: "Sudan", code: "249" },
    {country: "Suriname", code: "597" },
    {country: "Swaziland", code: "268" },
    {country: "Sweden", code: "46" },
    {country: "Switzerland", code: "41" },
    {country: "Syria", code: "963" },
    {country: "Taiwan", code: "886" },
    {country: "Tajikstan", code: "7" },
    {country: "Thailand", code: "66" },
    {country: "Togo", code: "228" },
    {country: "Tonga", code: "676" },
    {country: "Trinidad & Tobago", code: "1868" },
    {country: "Tunisia", code: "216" },
    {country: "Turkey", code: "90" },
    {country: "Turkmenistan", code: "7" },
    {country: "Turkmenistan", code: "993" },
    {country: "Turks & Caicos Islands", code: "1649" },
    {country: "Tuvalu", code: "688" },
    {country: "Uganda", code: "256" },
    {country: "Ukraine", code: "380" },
    {country: "United Arab Emirates", code: "971" },
    {country: "Uruguay", code: "598" },
    {country: "Uzbekistan", code: "7" },
    {country: "Vanuatu", code: "678" },
    {country: "Vatican City", code: "379" },
    {country: "Venezuela", code: "58" },
    {country: "Vietnam", code: "84" },
    {country: "Virgin Islands - British", code: "1284" },
    {country: "Virgin Islands - US", code: "1340" },
    {country: "Wallis & Futuna", code: "681" },
    {country: "Yemen(North)", code: "969" },
    {country: "Yemen(South)", code: "967" },
    {country: "Zambia", code: "260" },
    {country: "Zimbabwe", code: "263" },
]

@androideen
Copy link

androideen commented Oct 14, 2022

This is a minified version
$phoneCodes=['AF'=>'93','AL'=>'355','DZ'=>'213','AS'=>'1-684','AD'=>'376','AO'=>'244','AI'=>'1-264','AQ'=>'672','AG'=>'1-268','AR'=>'54','AM'=>'374','AW'=>'297','AU'=>'61','AT'=>'43','AZ'=>'994','BS'=>'1-242','BH'=>'973','BD'=>'880','BB'=>'1-246','BY'=>'375','BE'=>'32','BZ'=>'501','BJ'=>'229','BM'=>'1-441','BT'=>'975','BO'=>'591','BA'=>'387','BW'=>'267','BR'=>'55','IO'=>'246','VG'=>'1-284','BN'=>'673','BG'=>'359','BF'=>'226','BI'=>'257','KH'=>'855','CM'=>'237','CA'=>'1','CV'=>'238','KY'=>'1-345','CF'=>'236','TD'=>'235','CL'=>'56','CN'=>'86','CX'=>'61','CC'=>'61','CO'=>'57','KM'=>'269','CK'=>'682','CR'=>'506','HR'=>'385','CU'=>'53','CW'=>'599','CY'=>'357','CZ'=>'420','CD'=>'243','DK'=>'45','DJ'=>'253','DM'=>'1-767','DO'=>'1-809','TL'=>'670','EC'=>'593','EG'=>'20','SV'=>'503','GQ'=>'240','ER'=>'291','EE'=>'372','ET'=>'251','FK'=>'500','FO'=>'298','FJ'=>'679','FI'=>'358','FR'=>'33','PF'=>'689','GA'=>'241','GM'=>'220','GE'=>'995','DE'=>'49','GH'=>'233','GI'=>'350','GR'=>'30','GL'=>'299','GD'=>'1-473','GU'=>'1-671','GT'=>'502','GG'=>'44-1481', 'GN'=>'224','GW'=>'245','GY'=>'592','HT'=>'509','HN'=>'504','HK'=>'852','HU'=>'36','IS'=>'354','IN'=>'91','ID'=>'62','IR'=>'98','IQ'=>'964','IE'=>'353','IM'=>'44-1624','IL'=>'972','IT'=>'39','CI'=>'225','JM'=>'1-876','JP'=>'81','JE'=>'44-1534','JO'=>'962','KZ'=>'7','KE'=>'254','KI'=>'686','XK'=>'383','KW'=>'965','KG'=>'996','LA'=>'856','LV'=>'371','LB'=>'961','LS'=>'266','LR'=>'231','LY'=>'218','LI'=>'423','LT'=>'370','LU'=>'352','MO'=>'853','MK'=>'389','MG'=>'261','MW'=>'265','MY'=>'60','MV'=>'960','ML'=>'223','MT'=>'356','MH'=>'692','MR'=>'222','MU'=>'230','YT'=>'262','MX'=>'52','FM'=>'691','MD'=>'373','MC'=>'377','MN'=>'976','ME'=>'382','MS'=>'1-664','MA'=>'212','MZ'=>'258','MM'=>'95','NA'=>'264','NR'=>'674','NP'=>'977','NL'=>'31','AN'=>'599','NC'=>'687','NZ'=>'64','NI'=>'505','NE'=>'227','NG'=>'234','NU'=>'683','KP'=>'850','MP'=>'1-670','NO'=>'47','OM'=>'968','PK'=>'92','PW'=>'680','PS'=>'970','PA'=>'507','PG'=>'675','PY'=>'595','PE'=>'51','PH'=>'63','PN'=>'64','PL'=>'48','PT'=>'351','PR'=>'1-787','QA'=>'974','CG'=>'242','RE'=>'262','RO'=>'40','RU'=>'7','RW'=>'250','BL'=>'590','SH'=>'290','KN'=>'1-869','LC'=>'1-758','MF'=>'590','PM'=>'508','VC'=>'1-784', 'WS'=>'685','SM'=>'378','ST'=>'239','SA'=>'966','SN'=>'221','RS'=>'381','SC'=>'248','SL'=>'232','SG'=>'65','SX'=>'1-721','SK'=>'421','SI'=>'386','SB'=>'677','SO'=>'252','ZA'=>'27','KR'=>'82','SS'=>'211','ES'=>'34','LK'=>'94','SD'=>'249','SR'=>'597','SJ'=>'47','SZ'=>'268','SE'=>'46','CH'=>'41','SY'=>'963','TW'=>'886','TJ'=>'992','TZ'=>'255','TH'=>'66','TG'=>'228','TK'=>'690','TO'=>'676','TT'=>'1-868','TN'=>'216','TR'=>'90','TM'=>'993','TC'=>'1-649','TV'=>'688','VI'=>'1-340','UG'=>'256','UA'=>'380','AE'=>'971','GB'=>'44','US'=>'1','UY'=>'598','UZ'=>'998','VU'=>'678','VA'=>'379','VE'=>'58','VN'=>'84','WF'=>'681','EH'=>'212','YE'=>'967','ZM'=>'260','ZW'=>'263'];
I get it from https://tleapps.com/array-of-country-phone-codes-in-php/

@walidaalhomsi
Copy link

@ncla Many thanks for the reference, it is really helpful.

@quenbyako
Copy link

@grexlort are you even checking provided info??? Who said to you that +7880 is Georgian country code and even valid phone prefix?

I saw 6th (SIXTH!!!) service, which yousing your invalid info, and don't see any source but your gist. Fix it ASAP! 🤬

@AhmedRChuhdary
Copy link

Where is +92 => Pakistan, Islamic Republic of

@promel
Copy link

promel commented Oct 11, 2023

Thanks

@promel
Copy link

promel commented Oct 11, 2023

$array = [
"UK"=> "44",
"USA"=> "1",
"Algeria"=> "213",
"Andorra"=> "376",
"Angola"=> "244",
"Anguilla"=> "1264",
"Antigua & Barbuda"=> "1268",
"Argentina"=> "54",
"Armenia"=> "374",
"Aruba"=> "297",
"Australia"=> "61",
"Austria"=> "43",
"Azerbaijan"=> "994",
"Bahamas"=> "1242",
"Bahrain"=> "973",
"Bangladesh"=> "880",
"Barbados"=> "1246",
"Belarus"=> "375",
"Belgium"=> "32",
"Belize"=> "501",
"Benin"=> "229",
"Bermuda"=> "1441",
"Bhutan"=> "975",
"Bolivia"=> "591",
"Bosnia Herzegovina"=> "387",
"Botswana"=> "267",
"Brazil"=> "55",
"Brunei"=> "673",
"Bulgaria"=> "359",
"Burkina Faso"=> "226",
"Burundi"=> "257",
"Cambodia"=> "855",
"Cameroon"=> "237",
"Canada"=> "1",
"Cape Verde Islands"=> "238",
"Cayman Islands"=> "1345",
"Central African Republic"=> "236",
"Chile"=> "56",
"China"=> "86",
"Colombia"=> "57",
"Comoros"=> "269",
"Congo"=> "242",
"Cook Islands"=> "682",
"Côte d'Ivoire" => "225",
"Costa Rica"=> "506",
"Croatia"=> "385",
"Cuba"=> "53",
"Cyprus North"=> "90392",
"Cyprus South"=> "357",
"Czech Republic"=> "42",
"Denmark"=> "45",
"Djibouti"=> "253",
"Dominica"=> "1809",
"Dominican Republic"=> "1809",
"Ecuador"=> "593",
"Egypt"=> "20",
"El Salvador"=> "503",
"Equatorial Guinea"=> "240",
"Eritrea"=> "291",
"Estonia"=> "372",
"Ethiopia"=> "251",
"Falkland Islands"=> "500",
"Faroe Islands"=> "298",
"Fiji"=> "679",
"Finland"=> "358",
"France"=> "33",
"French Guiana"=> "594",
"French Polynesia"=> "689",
"Gabon"=> "241",
"Gambia"=> "220",
"Georgia"=> "995",
"Germany"=> "49",
"Ghana"=> "233",
"Gibraltar"=> "350",
"Greece"=> "30",
"Greenland"=> "299",
"Grenada"=> "1473",
"Guadeloupe"=> "590",
"Guam"=> "671",
"Guatemala"=> "502",
"Guinea"=> "224",
"Guinea - Bissau"=> "245",
"Guyana"=> "592",
"Haiti"=> "509",
"Honduras"=> "504",
"Hong Kong"=> "852",
"Hungary"=> "36",
"Iceland"=> "354",
"India"=> "91",
"Indonesia"=> "62",
"Iran"=> "98",
"Iraq"=> "964",
"Ireland"=> "353",
"Israel"=> "972",
"Italy"=> "39",
"Jamaica"=> "1876",
"Japan"=> "81",
"Jordan"=> "962",
"Kazakhstan"=> "7",
"Kenya"=> "254",
"Kiribati"=> "686",
"Korea North"=> "850",
"Korea South"=> "82",
"Kuwait"=> "965",
"Kyrgyzstan"=> "996",
"Laos"=> "856",
"Latvia"=> "371",
"Lebanon"=> "961",
"Lesotho"=> "266",
"Liberia"=> "231",
"Libya"=> "218",
"Liechtenstein"=> "417",
"Lithuania"=> "370",
"Luxembourg"=> "352",
"Macao"=> "853",
"Macedonia"=> "389",
"Madagascar"=> "261",
"Malawi"=> "265",
"Malaysia"=> "60",
"Maldives"=> "960",
"Mali"=> "223",
"Malta"=> "356",
"Marshall Islands"=> "692",
"Martinique"=> "596",
"Mauritania"=> "222",
"Mayotte"=> "269",
"Mexico"=> "52",
"Micronesia"=> "691",
"Moldova"=> "373",
"Monaco"=> "377",
"Mongolia"=> "976",
"Montserrat"=> "1664",
"Morocco"=> "212",
"Mozambique"=> "258",
"Myanmar"=> "95",
"Namibia"=> "264",
"Nauru"=> "674",
"Nepal"=> "977",
"Netherlands"=> "31",
"New Caledonia"=> "687",
"New Zealand"=> "64",
"Nicaragua"=> "505",
"Niger"=> "227",
"Nigeria"=> "234",
"Niue"=> "683",
"Norfolk Islands"=> "672",
"Northern Marianas"=> "670",
"Norway"=> "47",
"Oman"=> "968",
"Palau"=> "680",
"Panama"=> "507",
"Papua New Guinea"=> "675",
"Paraguay"=> "595",
"Peru"=> "51",
"Philippines"=> "63",
"Poland"=> "48",
"Portugal"=> "351",
"Puerto Rico"=> "1787",
"Qatar"=> "974",
"Reunion"=> "262",
"Romania"=> "40",
"Russia"=> "7",
"Rwanda"=> "250",
"San Marino"=> "378",
"Sao Tome & Principe"=> "239",
"Saudi Arabia"=> "966",
"Senegal"=> "221",
"Serbia"=> "381",
"Seychelles"=> "248",
"Sierra Leone"=> "232",
"Singapore"=> "65",
"Slovak Republic"=> "421",
"Slovenia"=> "386",
"Solomon Islands"=> "677",
"Somalia"=> "252",
"South Africa"=> "27",
"Spain"=> "34",
"Sri Lanka"=> "94",
"St. Helena"=> "290",
"St. Kitts"=> "1869",
"St. Lucia"=> "1758",
"Sudan"=> "249",
"Suriname"=> "597",
"Swaziland"=> "268",
"Sweden"=> "46",
"Switzerland"=> "41",
"Syria"=> "963",
"Taiwan"=> "886",
"Tajikstan"=> "7",
"Thailand"=> "66",
"Togo"=> "228",
"Tonga"=> "676",
"Trinidad & Tobago"=> "1868",
"Tunisia"=> "216",
"Turkey"=> "90",
"Turkmenistan"=> "7",
"Turkmenistan"=> "993",
"Turks & Caicos Islands"=> "1649",
"Tuvalu"=> "688",
"Uganda"=> "256",
"Ukraine"=> "380",
"United Arab Emirates"=> "971",
"Uruguay"=> "598",
"Uzbekistan"=> "998",
"Vanuatu"=> "678",
"Vatican City"=> "379",
"Venezuela"=> "58",
"Vietnam"=> "84",
"Virgin Islands - British"=> "1284",
"Virgin Islands - US"=> "1340",
"Wallis & Futuna"=> "681",
"Yemen"=> "North""969",
"Yemen"=> "South""967",
"Zambia"=> "260",
"Zimbabwe"=> "263",
];

@etoyowimura
Copy link

Uzbekistan is +998

@promel
Copy link

promel commented Nov 17, 2023

Thanks I'll update it

Uzbekistan is +998

@quenbyako
Copy link

@promel Hey, may i ask you to update also Georgian country code? It's +995, and, as far as google tells me, only this gist and comments providing invalid info to services, so may be it's better to update at least your info? 😊

@promel
Copy link

promel commented Dec 14, 2023

@promel Hey, may i ask you to update also Georgian country code? It's +995, and, as far as google tells me, only this gist and comments providing invalid info to services, so may be it's better to update at least your info? 😊

done

@Ebedthan
Copy link

Côte d'Ivoire is +225

@promel
Copy link

promel commented May 19, 2024

Côte d'Ivoire is +225

I have updated it

@grzegorztomasiak
Copy link

grzegorztomasiak commented May 23, 2024

"Turkmenistan"=> "7",
"Turkmenistan"=> "993",

"Yemen"=> "North""969",
"Yemen"=> "South""967",

"Korea North"=> "850",
"Korea South"=> "82",

No countries like Korea South or Korea North, sounds silly like States United.

the hell is this

@kameih
Copy link

kameih commented Jun 1, 2024

Here is the updated version. You can directly use in the code

$countries = [
["country" => "UK", "code" => "44"],
["country" => "USA", "code" => "1"],
["country" => "Algeria", "code" => "213"],
["country" => "Andorra", "code" => "376"],
["country" => "Angola", "code" => "244"],
["country" => "Anguilla", "code" => "1264"],
["country" => "Antigua & Barbuda", "code" => "1268"],
["country" => "Argentina", "code" => "54"],
["country" => "Armenia", "code" => "374"],
["country" => "Aruba", "code" => "297"],
["country" => "Australia", "code" => "61"],
["country" => "Austria", "code" => "43"],
["country" => "Azerbaijan", "code" => "994"],
["country" => "Bahamas", "code" => "1242"],
["country" => "Bahrain", "code" => "973"],
["country" => "Bangladesh", "code" => "880"],
["country" => "Barbados", "code" => "1246"],
["country" => "Belarus", "code" => "375"],
["country" => "Belgium", "code" => "32"],
["country" => "Belize", "code" => "501"],
["country" => "Benin", "code" => "229"],
["country" => "Bermuda", "code" => "1441"],
["country" => "Bhutan", "code" => "975"],
["country" => "Bolivia", "code" => "591"],
["country" => "Bosnia & Herzegovina", "code" => "387"],
["country" => "Botswana", "code" => "267"],
["country" => "Brazil", "code" => "55"],
["country" => "Brunei", "code" => "673"],
["country" => "Bulgaria", "code" => "359"],
["country" => "Burkina Faso", "code" => "226"],
["country" => "Burundi", "code" => "257"],
["country" => "Cambodia", "code" => "855"],
["country" => "Cameroon", "code" => "237"],
["country" => "Canada", "code" => "1"],
["country" => "Cape Verde", "code" => "238"],
["country" => "Cayman Islands", "code" => "1345"],
["country" => "Central African Republic", "code" => "236"],
["country" => "Chile", "code" => "56"],
["country" => "China", "code" => "86"],
["country" => "Colombia", "code" => "57"],
["country" => "Comoros", "code" => "269"],
["country" => "Congo", "code" => "242"],
["country" => "Congo (Democratic Republic)", "code" => "243"],
["country" => "Cook Islands", "code" => "682"],
["country" => "Costa Rica", "code" => "506"],
["country" => "Croatia", "code" => "385"],
["country" => "Cuba", "code" => "53"],
["country" => "Cyprus", "code" => "357"],
["country" => "Czech Republic", "code" => "420"],
["country" => "Denmark", "code" => "45"],
["country" => "Djibouti", "code" => "253"],
["country" => "Dominica", "code" => "1767"],
["country" => "Dominican Republic", "code" => "1-809"],
["country" => "Ecuador", "code" => "593"],
["country" => "Egypt", "code" => "20"],
["country" => "El Salvador", "code" => "503"],
["country" => "Equatorial Guinea", "code" => "240"],
["country" => "Eritrea", "code" => "291"],
["country" => "Estonia", "code" => "372"],
["country" => "Ethiopia", "code" => "251"],
["country" => "Falkland Islands", "code" => "500"],
["country" => "Faroe Islands", "code" => "298"],
["country" => "Fiji", "code" => "679"],
["country" => "Finland", "code" => "358"],
["country" => "France", "code" => "33"],
["country" => "French Guiana", "code" => "594"],
["country" => "French Polynesia", "code" => "689"],
["country" => "Gabon", "code" => "241"],
["country" => "Gambia", "code" => "220"],
["country" => "Georgia", "code" => "995"],
["country" => "Germany", "code" => "49"],
["country" => "Ghana", "code" => "233"],
["country" => "Gibraltar", "code" => "350"],
["country" => "Greece", "code" => "30"],
["country" => "Greenland", "code" => "299"],
["country" => "Grenada", "code" => "1473"],
["country" => "Guadeloupe", "code" => "590"],
["country" => "Guam", "code" => "1671"],
["country" => "Guatemala", "code" => "502"],
["country" => "Guinea", "code" => "224"],
["country" => "Guinea-Bissau", "code" => "245"],
["country" => "Guyana", "code" => "592"],
["country" => "Haiti", "code" => "509"],
["country" => "Honduras", "code" => "504"],
["country" => "Hong Kong", "code" => "852"],
["country" => "Hungary", "code" => "36"],
["country" => "Iceland", "code" => "354"],
["country" => "India", "code" => "91"],
["country" => "Indonesia", "code" => "62"],
["country" => "Iran", "code" => "98"],
["country" => "Iraq", "code" => "964"],
["country" => "Ireland", "code" => "353"],
["country" => "Israel", "code" => "972"],
["country" => "Italy", "code" => "39"],
["country" => "Jamaica", "code" => "1876"],
["country" => "Japan", "code" => "81"],
["country" => "Jordan", "code" => "962"],
["country" => "Kazakhstan", "code" => "7"],
["country" => "Kenya", "code" => "254"],
["country" => "Kiribati", "code" => "686"],
["country" => "Korea North", "code" => "850"],
["country" => "Korea South", "code" => "82"],
["country" => "Kuwait", "code" => "965"],
["country" => "Kyrgyzstan", "code" => "996"],
["country" => "Laos", "code" => "856"],
["country" => "Latvia", "code" => "371"],
["country" => "Lebanon", "code" => "961"],
["country" => "Lesotho", "code" => "266"],
["country" => "Liberia", "code" => "231"],
["country" => "Libya", "code" => "218"],
["country" => "Liechtenstein", "code" => "423"],
["country" => "Lithuania", "code" => "370"],
["country" => "Luxembourg", "code" => "352"],
["country" => "Macao", "code" => "853"],
["country" => "Macedonia", "code" => "389"],
["country" => "Madagascar", "code" => "261"],
["country" => "Malawi", "code" => "265"],
["country" => "Malaysia", "code" => "60"],
["country" => "Maldives", "code" => "960"],
["country" => "Mali", "code" => "223"],
["country" => "Malta", "code" => "356"],
["country" => "Marshall Islands", "code" => "692"],
["country" => "Martinique", "code" => "596"],
["country" => "Mauritania", "code" => "222"],
["country" => "Mauritius", "code" => "230"],
["country" => "Mayotte", "code" => "262"],
["country" => "Mexico", "code" => "52"],
["country" => "Micronesia", "code" => "691"],
["country" => "Moldova", "code" => "373"],
["country" => "Monaco", "code" => "377"],
["country" => "Mongolia", "code" => "976"],
["country" => "Montserrat", "code" => "1664"],
["country" => "Morocco", "code" => "212"],
["country" => "Mozambique", "code" => "258"],
["country" => "Myanmar", "code" => "95"],
["country" => "Namibia", "code" => "264"],
["country" => "Nauru", "code" => "674"],
["country" => "Nepal", "code" => "977"],
["country" => "Netherlands", "code" => "31"],
["country" => "New Caledonia", "code" => "687"],
["country" => "New Zealand", "code" => "64"],
["country" => "Nicaragua", "code" => "505"],
["country" => "Niger", "code" => "227"],
["country" => "Nigeria", "code" => "234"],
["country" => "Niue", "code" => "683"],
["country" => "Norfolk Islands", "code" => "672"],
["country" => "Northern Marianas", "code" => "1670"],
["country" => "Norway", "code" => "47"],
["country" => "Oman", "code" => "968"],
["country" => "Palau", "code" => "680"],
["country" => "Panama", "code" => "507"],
["country" => "Papua New Guinea", "code" => "675"],
["country" => "Paraguay", "code" => "595"],
["country" => "Peru", "code" => "51"],
["country" => "Philippines", "code" => "63"],
["country" => "Poland", "code" => "48"],
["country" => "Portugal", "code" => "351"],
["country" => "Puerto Rico", "code" => "1787"],
["country" => "Qatar", "code" => "974"],
["country" => "Reunion", "code" => "262"],
["country" => "Romania", "code" => "40"],
["country" => "Russia", "code" => "7"],
["country" => "Rwanda", "code" => "250"],
["country" => "San Marino", "code" => "378"],
["country" => "Sao Tome & Principe", "code" => "239"],
["country" => "Saudi Arabia", "code" => "966"],
["country" => "Senegal", "code" => "221"],
["country" => "Serbia", "code" => "381"],
["country" => "Seychelles", "code" => "248"],
["country" => "Sierra Leone", "code" => "232"],
["country" => "Singapore", "code" => "65"],
["country" => "Slovak Republic", "code" => "421"],
["country" => "Slovenia", "code" => "386"],
["country" => "Solomon Islands", "code" => "677"],
["country" => "Somalia", "code" => "252"],
["country" => "South Africa", "code" => "27"],
["country" => "Spain", "code" => "34"],
["country" => "Sri Lanka", "code" => "94"],
["country" => "St. Helena", "code" => "290"],
["country" => "St. Kitts", "code" => "1869"],
["country" => "St. Lucia", "code" => "1758"],
["country" => "Sudan", "code" => "249"],
["country" => "Suriname", "code" => "597"],
["country" => "Swaziland", "code" => "268"],
["country" => "Sweden", "code" => "46"],
["country" => "Switzerland", "code" => "41"],
["country" => "Syria", "code" => "963"],
["country" => "Taiwan", "code" => "886"],
["country" => "Tajikistan", "code" => "992"],
["country" => "Thailand", "code" => "66"],
["country" => "Togo", "code" => "228"],
["country" => "Tonga", "code" => "676"],
["country" => "Trinidad & Tobago", "code" => "1868"],
["country" => "Tunisia", "code" => "216"],
["country" => "Turkey", "code" => "90"],
["country" => "Turkmenistan", "code" => "993"],
["country" => "Turks & Caicos Islands", "code" => "1649"],
["country" => "Tuvalu", "code" => "688"],
["country" => "Uganda", "code" => "256"],
["country" => "Ukraine", "code" => "380"],
["country" => "United Arab Emirates", "code" => "971"],
["country" => "Uruguay", "code" => "598"],
["country" => "Uzbekistan", "code" => "998"],
["country" => "Vanuatu", "code" => "678"],
["country" => "Vatican City", "code" => "379"],
["country" => "Venezuela", "code" => "58"],
["country" => "Vietnam", "code" => "84"],
["country" => "Virgin Islands - British", "code" => "1284"],
["country" => "Virgin Islands - US", "code" => "1340"],
["country" => "Wallis & Futuna", "code" => "681"],
["country" => "Yemen", "code" => "967"],
["country" => "Zambia", "code" => "260"],
["country" => "Zimbabwe", "code" => "263"]
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment