Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@wouterds wouterds commented May 28, 2015

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