Skip to content

Instantly share code, notes, and snippets.

@wouterds
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wouterds/2ccac8e3ada21b529e3c to your computer and use it in GitHub Desktop.
Save wouterds/2ccac8e3ada21b529e3c to your computer and use it in GitHub Desktop.
postalCodeMapping.php
<?php
public function provinceByPostalCode($postalCode)
{
$province = null;
if ($postalCode >= 1000 && $postalCode < 1300) {
$province = 'brussels';
} else if ($postalCode < 1500) {
$province = 'walloon-brabant';
} else if ($postalCode < 2000) {
$province = 'flemish-brabant';
} else if ($postalCode < 3000) {
$province = 'antwerp';
} else if ($postalCode < 3500) {
$province = 'flemish-brabant';
} else if ($postalCode < 4000) {
$province = 'limburg';
} else if ($postalCode < 5000) {
$province = 'liege';
} else if ($postalCode < 6000) {
$province = 'namur';
} else if ($postalCode < 6600) {
$province = 'hainaut';
} else if ($postalCode < 7000) {
$province = 'luxembourg';
} else if ($postalCode < 8000) {
$province = 'hainaut';
} else if ($postalCode < 9000) {
$province = 'west-flanders';
} else if ($postalCode < 10000) {
$province = 'east-flanders';
}
return $province;
}
@wouterds
Copy link
Author

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