Skip to content

@vxnick /gist:1722753
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PHP Country Array
<?php
function country_array ($id = null)
{
$list = array
(
0 => "Afghanistan",
1 => "Albania",
2 => "Algeria",
3 => "American Samoa",
4 => "Andorra",
5 => "Angola",
6 => "Anguilla",
7 => "Antarctica",
8 => "Antigua and Barbuda",
9 => "Argentina",
10 => "Armenia",
11 => "Aruba",
12 => "Australia",
13 => "Austria",
14 => "Azerbaijan",
15 => "Bahamas",
16 => "Bahrain",
17 => "Bangladesh",
18 => "Barbados",
19 => "Belarus",
20 => "Belgium",
21 => "Belize",
22 => "Benin",
23 => "Bermuda",
24 => "Bhutan",
25 => "Bolivia",
26 => "Bosnia and Herzegovina",
27 => "Botswana",
28 => "Bouvet Island",
29 => "Brazil",
30 => "British Indian Ocean Territory",
31 => "Brunei Darussalam",
32 => "Bulgaria",
33 => "Burkina Faso",
34 => "Burundi",
35 => "Cambodia",
36 => "Cameroon",
37 => "Canada",
38 => "Cape Verde",
39 => "Cayman Islands",
40 => "Central African Republic",
41 => "Chad",
42 => "Chile",
43 => "China",
44 => "Christmas Island",
45 => "Cocos (Keeling) Islands",
46 => "Colombia",
47 => "Comoros",
48 => "Congo",
49 => "Congo, the Democratic Republic of the",
50 => "Cook Islands",
51 => "Costa Rica",
52 => "Cote D'Ivoire",
53 => "Croatia",
54 => "Cuba",
55 => "Cyprus",
56 => "Czech Republic",
57 => "Denmark",
58 => "Djibouti",
59 => "Dominica",
60 => "Dominican Republic",
61 => "Ecuador",
62 => "Egypt",
63 => "El Salvador",
64 => "Equatorial Guinea",
65 => "Eritrea",
66 => "Estonia",
67 => "Ethiopia",
68 => "Falkland Islands (Malvinas)",
69 => "Faroe Islands",
70 => "Fiji",
71 => "Finland",
72 => "France",
73 => "French Guiana",
74 => "French Polynesia",
75 => "French Southern Territories",
76 => "Gabon",
77 => "Gambia",
78 => "Georgia",
79 => "Germany",
80 => "Ghana",
81 => "Gibraltar",
82 => "Greece",
83 => "Greenland",
84 => "Grenada",
85 => "Guadeloupe",
86 => "Guam",
87 => "Guatemala",
88 => "Guinea",
89 => "Guinea-Bissau",
90 => "Guyana",
91 => "Haiti",
92 => "Heard Island and Mcdonald Islands",
93 => "Holy See (Vatican City State)",
94 => "Honduras",
95 => "Hong Kong",
96 => "Hungary",
97 => "Iceland",
98 => "India",
99 => "Indonesia",
100 => "Iran, Islamic Republic of",
101 => "Iraq",
102 => "Ireland",
103 => "Israel",
104 => "Italy",
105 => "Jamaica",
106 => "Japan",
107 => "Jordan",
108 => "Kazakhstan",
109 => "Kenya",
110 => "Kiribati",
111 => "Korea, Democratic People's Republic of",
112 => "Korea, Republic of",
113 => "Kuwait",
114 => "Kyrgyzstan",
115 => "Lao People's Democratic Republic",
116 => "Latvia",
117 => "Lebanon",
118 => "Lesotho",
119 => "Liberia",
120 => "Libyan Arab Jamahiriya",
121 => "Liechtenstein",
122 => "Lithuania",
123 => "Luxembourg",
124 => "Macao",
125 => "Macedonia, the Former Yugoslav Republic of",
126 => "Madagascar",
127 => "Malawi",
128 => "Malaysia",
129 => "Maldives",
130 => "Mali",
131 => "Malta",
132 => "Marshall Islands",
133 => "Martinique",
134 => "Mauritania",
135 => "Mauritius",
136 => "Mayotte",
137 => "Mexico",
138 => "Micronesia, Federated States of",
139 => "Moldova, Republic of",
140 => "Monaco",
141 => "Mongolia",
142 => "Montserrat",
143 => "Morocco",
144 => "Mozambique",
145 => "Myanmar",
146 => "Namibia",
147 => "Nauru",
148 => "Nepal",
149 => "Netherlands",
150 => "Netherlands Antilles",
151 => "New Caledonia",
152 => "New Zealand",
153 => "Nicaragua",
154 => "Niger",
155 => "Nigeria",
156 => "Niue",
157 => "Norfolk Island",
158 => "Northern Mariana Islands",
159 => "Norway",
160 => "Oman",
161 => "Pakistan",
162 => "Palau",
163 => "Palestinian Territory, Occupied",
164 => "Panama",
165 => "Papua New Guinea",
166 => "Paraguay",
167 => "Peru",
168 => "Philippines",
169 => "Pitcairn",
170 => "Poland",
171 => "Portugal",
172 => "Puerto Rico",
173 => "Qatar",
174 => "Reunion",
175 => "Romania",
176 => "Russian Federation",
177 => "Rwanda",
178 => "Saint Helena",
179 => "Saint Kitts and Nevis",
180 => "Saint Lucia",
181 => "Saint Pierre and Miquelon",
182 => "Saint Vincent and the Grenadines",
183 => "Samoa",
184 => "San Marino",
185 => "Sao Tome and Principe",
186 => "Saudi Arabia",
187 => "Senegal",
188 => "Serbia and Montenegro",
189 => "Seychelles",
190 => "Sierra Leone",
191 => "Singapore",
192 => "Slovakia",
193 => "Slovenia",
194 => "Solomon Islands",
195 => "Somalia",
196 => "South Africa",
197 => "South Georgia and the South Sandwich Islands",
198 => "Spain",
199 => "Sri Lanka",
200 => "Sudan",
201 => "Suriname",
202 => "Svalbard and Jan Mayen",
203 => "Swaziland",
204 => "Sweden",
205 => "Switzerland",
206 => "Syrian Arab Republic",
207 => "Taiwan, Province of China",
208 => "Tajikistan",
209 => "Tanzania, United Republic of",
210 => "Thailand",
211 => "Timor-Leste",
212 => "Togo",
213 => "Tokelau",
214 => "Tonga",
215 => "Trinidad and Tobago",
216 => "Tunisia",
217 => "Turkey",
218 => "Turkmenistan",
219 => "Turks and Caicos Islands",
220 => "Tuvalu",
221 => "Uganda",
222 => "Ukraine",
223 => "United Arab Emirates",
224 => "United Kingdom",
225 => "United States",
226 => "United States Minor Outlying Islands",
227 => "Uruguay",
228 => "Uzbekistan",
229 => "Vanuatu",
230 => "Venezuela",
231 => "Vietnam",
232 => "Virgin Islands, British",
233 => "Virgin Islands, U.S.",
234 => "Wallis and Futuna",
235 => "Western Sahara",
236 => "Yemen",
237 => "Zambia",
238 => "Zimbabwe"
);
if (is_null($id))
{
return $list;
}
else
{
return $list[$id];
}
}
// "United Kingdom"
echo country_array(224);
// the full array above...
echo '<pre>';
print_r(country_array());
echo '</pre>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.