Skip to content

Instantly share code, notes, and snippets.

@sumanthkumarc
Last active June 3, 2023 22:13
Show Gist options
  • Select an option

  • Save sumanthkumarc/3204c761eaa1646f3a4fd6cb1cf99e7c to your computer and use it in GitHub Desktop.

Select an option

Save sumanthkumarc/3204c761eaa1646f3a4fd6cb1cf99e7c to your computer and use it in GitHub Desktop.
EU (European country code and names list) in PHP array format
<?php
function get_eu_countries() {
$countries = [];
$countries['AT'] = ['name' => 'Austria',];
$countries['BE'] = ['name' => 'Belgium',];
$countries['BG'] = ['name' => 'Bulgaria',];
$countries['CY'] = ['name' => 'Cyprus',];
$countries['CZ'] = ['name' => 'Czech Republic',];
$countries['DE'] = ['name' => 'Germany',];
$countries['DK'] = ['name' => 'Denmark',];
$countries['EE'] = ['name' => 'Estonia',];
$countries['ES'] = ['name' => 'Spain',];
$countries['FI'] = ['name' => 'Finland',];
$countries['FR'] = ['name' => 'France',];
$countries['GB'] = ['name' => 'United Kingdom',];
$countries['GR'] = ['name' => 'Greece',];
$countries['HU'] = ['name' => 'Hungary',];
$countries['HR'] = ['name' => 'Croatia',];
$countries['IE'] = ['name' => 'Ireland, Republic of (EIRE)',];
$countries['IT'] = ['name' => 'Italy',];
$countries['LT'] = ['name' => 'Lithuania',];
$countries['LU'] = ['name' => 'Luxembourg',];
$countries['LV'] = ['name' => 'Latvia',];
$countries['MT'] = ['name' => 'Malta',];
$countries['NL'] = ['name' => 'Netherlands',];
$countries['PL'] = ['name' => 'Poland',];
$countries['PT'] = ['name' => 'Portugal',];
$countries['RO'] = ['name' => 'Romania',];
$countries['SE'] = ['name' => 'Sweden',];
$countries['SI'] = ['name' => 'Slovenia',];
$countries['SK'] = ['name' => 'Slovakia',];
return $countries;
}
?>
@WebFactoryLtd
Copy link
Copy Markdown

You're a life saver :) Thank you!

@PhilETaylor
Copy link
Copy Markdown

$countries['GB'] = ['name' => 'United Kingdom',];

Cough Cough :) #Brexit :)

@trane77
Copy link
Copy Markdown

trane77 commented Jun 8, 2021

@trane77
Copy link
Copy Markdown

trane77 commented Jun 8, 2021

This structure would have made search by name doable:

$countries= [ [ 'code' => 'AT', 'name'=>'Austria'], [ 'code' => 'BE', 'name'=>'Belgium'], ... ];

Cheers

@outrank-james
Copy link
Copy Markdown

GB is no longer in the EU, so this line should be removed

$countries['GB'] = ['name' => 'United Kingdom',];

@consigliere23
Copy link
Copy Markdown

👍

@PhilETaylor
Copy link
Copy Markdown

PhilETaylor commented May 25, 2023 via email

@trane77
Copy link
Copy Markdown

trane77 commented May 25, 2023

@PhilETaylor can you explain the difference between the two? Thanks

@PhilETaylor
Copy link
Copy Markdown

Sure - I have to quote this at least once a month as I live in Jersey, Channel Islands, which are also not in the UK, but often people say we are (Ref: https://www.gov.je/Leisure/Jersey/pages/profile.aspx)

GB = "England, Scotland and Wales make up Great Britain"

UK = "The United Kingdom includes Great Britain (England, Scotland and Wales) and Northern Ireland"

@trane77
Copy link
Copy Markdown

trane77 commented Jun 3, 2023

Very interesting, thank you!

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