PHP Country Code to Continent


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function country_to_continent( $country ){
  2. $continent = '';
  3. if( $country == 'AF' ) $continent = 'Asia';
  4. if( $country == 'AX' ) $continent = 'Europe';
  5. if( $country == 'AL' ) $continent = 'Europe';
  6. if( $country == 'DZ' ) $continent = 'Africa';
  7. if( $country == 'AS' ) $continent = 'Oceania';
  8. if( $country == 'AD' ) $continent = 'Europe';
  9. if( $country == 'AO' ) $continent = 'Africa';
  10. if( $country == 'AI' ) $continent = 'North America';
  11. if( $country == 'AQ' ) $continent = 'Antarctica';
  12. if( $country == 'AG' ) $continent = 'North America';
  13. if( $country == 'AR' ) $continent = 'South America';
  14. if( $country == 'AM' ) $continent = 'Asia';
  15. if( $country == 'AW' ) $continent = 'North America';
  16. if( $country == 'AU' ) $continent = 'Oceania';
  17. if( $country == 'AT' ) $continent = 'Europe';
  18. if( $country == 'AZ' ) $continent = 'Asia';
  19. if( $country == 'BS' ) $continent = 'North America';
  20. if( $country == 'BH' ) $continent = 'Asia';
  21. if( $country == 'BD' ) $continent = 'Asia';
  22. if( $country == 'BB' ) $continent = 'North America';
  23. if( $country == 'BY' ) $continent = 'Europe';
  24. if( $country == 'BE' ) $continent = 'Europe';
  25. if( $country == 'BZ' ) $continent = 'North America';
  26. if( $country == 'BJ' ) $continent = 'Africa';
  27. if( $country == 'BM' ) $continent = 'North America';
  28. if( $country == 'BT' ) $continent = 'Asia';
  29. if( $country == 'BO' ) $continent = 'South America';
  30. if( $country == 'BA' ) $continent = 'Europe';
  31. if( $country == 'BW' ) $continent = 'Africa';
  32. if( $country == 'BV' ) $continent = 'Antarctica';
  33. if( $country == 'BR' ) $continent = 'South America';
  34. if( $country == 'IO' ) $continent = 'Asia';
  35. if( $country == 'VG' ) $continent = 'North America';
  36. if( $country == 'BN' ) $continent = 'Asia';
  37. if( $country == 'BG' ) $continent = 'Europe';
  38. if( $country == 'BF' ) $continent = 'Africa';
  39. if( $country == 'BI' ) $continent = 'Africa';
  40. if( $country == 'KH' ) $continent = 'Asia';
  41. if( $country == 'CM' ) $continent = 'Africa';
  42. if( $country == 'CA' ) $continent = 'North America';
  43. if( $country == 'CV' ) $continent = 'Africa';
  44. if( $country == 'KY' ) $continent = 'North America';
  45. if( $country == 'CF' ) $continent = 'Africa';
  46. if( $country == 'TD' ) $continent = 'Africa';
  47. if( $country == 'CL' ) $continent = 'South America';
  48. if( $country == 'CN' ) $continent = 'Asia';
  49. if( $country == 'CX' ) $continent = 'Asia';
  50. if( $country == 'CC' ) $continent = 'Asia';
  51. if( $country == 'CO' ) $continent = 'South America';
  52. if( $country == 'KM' ) $continent = 'Africa';
  53. if( $country == 'CD' ) $continent = 'Africa';
  54. if( $country == 'CG' ) $continent = 'Africa';
  55. if( $country == 'CK' ) $continent = 'Oceania';
  56. if( $country == 'CR' ) $continent = 'North America';
  57. if( $country == 'CI' ) $continent = 'Africa';
  58. if( $country == 'HR' ) $continent = 'Europe';
  59. if( $country == 'CU' ) $continent = 'North America';
  60. if( $country == 'CY' ) $continent = 'Asia';
  61. if( $country == 'CZ' ) $continent = 'Europe';
  62. if( $country == 'DK' ) $continent = 'Europe';
  63. if( $country == 'DJ' ) $continent = 'Africa';
  64. if( $country == 'DM' ) $continent = 'North America';
  65. if( $country == 'DO' ) $continent = 'North America';
  66. if( $country == 'EC' ) $continent = 'South America';
  67. if( $country == 'EG' ) $continent = 'Africa';
  68. if( $country == 'SV' ) $continent = 'North America';
  69. if( $country == 'GQ' ) $continent = 'Africa';
  70. if( $country == 'ER' ) $continent = 'Africa';
  71. if( $country == 'EE' ) $continent = 'Europe';
  72. if( $country == 'ET' ) $continent = 'Africa';
  73. if( $country == 'FO' ) $continent = 'Europe';
  74. if( $country == 'FK' ) $continent = 'South America';
  75. if( $country == 'FJ' ) $continent = 'Oceania';
  76. if( $country == 'FI' ) $continent = 'Europe';
  77. if( $country == 'FR' ) $continent = 'Europe';
  78. if( $country == 'GF' ) $continent = 'South America';
  79. if( $country == 'PF' ) $continent = 'Oceania';
  80. if( $country == 'TF' ) $continent = 'Antarctica';
  81. if( $country == 'GA' ) $continent = 'Africa';
  82. if( $country == 'GM' ) $continent = 'Africa';
  83. if( $country == 'GE' ) $continent = 'Asia';
  84. if( $country == 'DE' ) $continent = 'Europe';
  85. if( $country == 'GH' ) $continent = 'Africa';
  86. if( $country == 'GI' ) $continent = 'Europe';
  87. if( $country == 'GR' ) $continent = 'Europe';
  88. if( $country == 'GL' ) $continent = 'North America';
  89. if( $country == 'GD' ) $continent = 'North America';
  90. if( $country == 'GP' ) $continent = 'North America';
  91. if( $country == 'GU' ) $continent = 'Oceania';
  92. if( $country == 'GT' ) $continent = 'North America';
  93. if( $country == 'GG' ) $continent = 'Europe';
  94. if( $country == 'GN' ) $continent = 'Africa';
  95. if( $country == 'GW' ) $continent = 'Africa';
  96. if( $country == 'GY' ) $continent = 'South America';
  97. if( $country == 'HT' ) $continent = 'North America';
  98. if( $country == 'HM' ) $continent = 'Antarctica';
  99. if( $country == 'VA' ) $continent = 'Europe';
  100. if( $country == 'HN' ) $continent = 'North America';
  101. if( $country == 'HK' ) $continent = 'Asia';
  102. if( $country == 'HU' ) $continent = 'Europe';
  103. if( $country == 'IS' ) $continent = 'Europe';
  104. if( $country == 'IN' ) $continent = 'Asia';
  105. if( $country == 'ID' ) $continent = 'Asia';
  106. if( $country == 'IR' ) $continent = 'Asia';
  107. if( $country == 'IQ' ) $continent = 'Asia';
  108. if( $country == 'IE' ) $continent = 'Europe';
  109. if( $country == 'IM' ) $continent = 'Europe';
  110. if( $country == 'IL' ) $continent = 'Asia';
  111. if( $country == 'IT' ) $continent = 'Europe';
  112. if( $country == 'JM' ) $continent = 'North America';
  113. if( $country == 'JP' ) $continent = 'Asia';
  114. if( $country == 'JE' ) $continent = 'Europe';
  115. if( $country == 'JO' ) $continent = 'Asia';
  116. if( $country == 'KZ' ) $continent = 'Asia';
  117. if( $country == 'KE' ) $continent = 'Africa';
  118. if( $country == 'KI' ) $continent = 'Oceania';
  119. if( $country == 'KP' ) $continent = 'Asia';
  120. if( $country == 'KR' ) $continent = 'Asia';
  121. if( $country == 'KW' ) $continent = 'Asia';
  122. if( $country == 'KG' ) $continent = 'Asia';
  123. if( $country == 'LA' ) $continent = 'Asia';
  124. if( $country == 'LV' ) $continent = 'Europe';
  125. if( $country == 'LB' ) $continent = 'Asia';
  126. if( $country == 'LS' ) $continent = 'Africa';
  127. if( $country == 'LR' ) $continent = 'Africa';
  128. if( $country == 'LY' ) $continent = 'Africa';
  129. if( $country == 'LI' ) $continent = 'Europe';
  130. if( $country == 'LT' ) $continent = 'Europe';
  131. if( $country == 'LU' ) $continent = 'Europe';
  132. if( $country == 'MO' ) $continent = 'Asia';
  133. if( $country == 'MK' ) $continent = 'Europe';
  134. if( $country == 'MG' ) $continent = 'Africa';
  135. if( $country == 'MW' ) $continent = 'Africa';
  136. if( $country == 'MY' ) $continent = 'Asia';
  137. if( $country == 'MV' ) $continent = 'Asia';
  138. if( $country == 'ML' ) $continent = 'Africa';
  139. if( $country == 'MT' ) $continent = 'Europe';
  140. if( $country == 'MH' ) $continent = 'Oceania';
  141. if( $country == 'MQ' ) $continent = 'North America';
  142. if( $country == 'MR' ) $continent = 'Africa';
  143. if( $country == 'MU' ) $continent = 'Africa';
  144. if( $country == 'YT' ) $continent = 'Africa';
  145. if( $country == 'MX' ) $continent = 'North America';
  146. if( $country == 'FM' ) $continent = 'Oceania';
  147. if( $country == 'MD' ) $continent = 'Europe';
  148. if( $country == 'MC' ) $continent = 'Europe';
  149. if( $country == 'MN' ) $continent = 'Asia';
  150. if( $country == 'ME' ) $continent = 'Europe';
  151. if( $country == 'MS' ) $continent = 'North America';
  152. if( $country == 'MA' ) $continent = 'Africa';
  153. if( $country == 'MZ' ) $continent = 'Africa';
  154. if( $country == 'MM' ) $continent = 'Asia';
  155. if( $country == 'NA' ) $continent = 'Africa';
  156. if( $country == 'NR' ) $continent = 'Oceania';
  157. if( $country == 'NP' ) $continent = 'Asia';
  158. if( $country == 'AN' ) $continent = 'North America';
  159. if( $country == 'NL' ) $continent = 'Europe';
  160. if( $country == 'NC' ) $continent = 'Oceania';
  161. if( $country == 'NZ' ) $continent = 'Oceania';
  162. if( $country == 'NI' ) $continent = 'North America';
  163. if( $country == 'NE' ) $continent = 'Africa';
  164. if( $country == 'NG' ) $continent = 'Africa';
  165. if( $country == 'NU' ) $continent = 'Oceania';
  166. if( $country == 'NF' ) $continent = 'Oceania';
  167. if( $country == 'MP' ) $continent = 'Oceania';
  168. if( $country == 'NO' ) $continent = 'Europe';
  169. if( $country == 'OM' ) $continent = 'Asia';
  170. if( $country == 'PK' ) $continent = 'Asia';
  171. if( $country == 'PW' ) $continent = 'Oceania';
  172. if( $country == 'PS' ) $continent = 'Asia';
  173. if( $country == 'PA' ) $continent = 'North America';
  174. if( $country == 'PG' ) $continent = 'Oceania';
  175. if( $country == 'PY' ) $continent = 'South America';
  176. if( $country == 'PE' ) $continent = 'South America';
  177. if( $country == 'PH' ) $continent = 'Asia';
  178. if( $country == 'PN' ) $continent = 'Oceania';
  179. if( $country == 'PL' ) $continent = 'Europe';
  180. if( $country == 'PT' ) $continent = 'Europe';
  181. if( $country == 'PR' ) $continent = 'North America';
  182. if( $country == 'QA' ) $continent = 'Asia';
  183. if( $country == 'RE' ) $continent = 'Africa';
  184. if( $country == 'RO' ) $continent = 'Europe';
  185. if( $country == 'RU' ) $continent = 'Europe';
  186. if( $country == 'RW' ) $continent = 'Africa';
  187. if( $country == 'BL' ) $continent = 'North America';
  188. if( $country == 'SH' ) $continent = 'Africa';
  189. if( $country == 'KN' ) $continent = 'North America';
  190. if( $country == 'LC' ) $continent = 'North America';
  191. if( $country == 'MF' ) $continent = 'North America';
  192. if( $country == 'PM' ) $continent = 'North America';
  193. if( $country == 'VC' ) $continent = 'North America';
  194. if( $country == 'WS' ) $continent = 'Oceania';
  195. if( $country == 'SM' ) $continent = 'Europe';
  196. if( $country == 'ST' ) $continent = 'Africa';
  197. if( $country == 'SA' ) $continent = 'Asia';
  198. if( $country == 'SN' ) $continent = 'Africa';
  199. if( $country == 'RS' ) $continent = 'Europe';
  200. if( $country == 'SC' ) $continent = 'Africa';
  201. if( $country == 'SL' ) $continent = 'Africa';
  202. if( $country == 'SG' ) $continent = 'Asia';
  203. if( $country == 'SK' ) $continent = 'Europe';
  204. if( $country == 'SI' ) $continent = 'Europe';
  205. if( $country == 'SB' ) $continent = 'Oceania';
  206. if( $country == 'SO' ) $continent = 'Africa';
  207. if( $country == 'ZA' ) $continent = 'Africa';
  208. if( $country == 'GS' ) $continent = 'Antarctica';
  209. if( $country == 'ES' ) $continent = 'Europe';
  210. if( $country == 'LK' ) $continent = 'Asia';
  211. if( $country == 'SD' ) $continent = 'Africa';
  212. if( $country == 'SR' ) $continent = 'South America';
  213. if( $country == 'SJ' ) $continent = 'Europe';
  214. if( $country == 'SZ' ) $continent = 'Africa';
  215. if( $country == 'SE' ) $continent = 'Europe';
  216. if( $country == 'CH' ) $continent = 'Europe';
  217. if( $country == 'SY' ) $continent = 'Asia';
  218. if( $country == 'TW' ) $continent = 'Asia';
  219. if( $country == 'TJ' ) $continent = 'Asia';
  220. if( $country == 'TZ' ) $continent = 'Africa';
  221. if( $country == 'TH' ) $continent = 'Asia';
  222. if( $country == 'TL' ) $continent = 'Asia';
  223. if( $country == 'TG' ) $continent = 'Africa';
  224. if( $country == 'TK' ) $continent = 'Oceania';
  225. if( $country == 'TO' ) $continent = 'Oceania';
  226. if( $country == 'TT' ) $continent = 'North America';
  227. if( $country == 'TN' ) $continent = 'Africa';
  228. if( $country == 'TR' ) $continent = 'Asia';
  229. if( $country == 'TM' ) $continent = 'Asia';
  230. if( $country == 'TC' ) $continent = 'North America';
  231. if( $country == 'TV' ) $continent = 'Oceania';
  232. if( $country == 'UG' ) $continent = 'Africa';
  233. if( $country == 'UA' ) $continent = 'Europe';
  234. if( $country == 'AE' ) $continent = 'Asia';
  235. if( $country == 'GB' ) $continent = 'Europe';
  236. if( $country == 'US' ) $continent = 'North America';
  237. if( $country == 'UM' ) $continent = 'Oceania';
  238. if( $country == 'VI' ) $continent = 'North America';
  239. if( $country == 'UY' ) $continent = 'South America';
  240. if( $country == 'UZ' ) $continent = 'Asia';
  241. if( $country == 'VU' ) $continent = 'Oceania';
  242. if( $country == 'VE' ) $continent = 'South America';
  243. if( $country == 'VN' ) $continent = 'Asia';
  244. if( $country == 'WF' ) $continent = 'Oceania';
  245. if( $country == 'EH' ) $continent = 'Africa';
  246. if( $country == 'YE' ) $continent = 'Asia';
  247. if( $country == 'ZM' ) $continent = 'Africa';
  248. if( $country == 'ZW' ) $continent = 'Africa';
  249. return $continent;
  250. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.