Last active
August 29, 2015 14:22
-
-
Save wouterds/2ccac8e3ada21b529e3c to your computer and use it in GitHub Desktop.
postalCodeMapping.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on data from BPost: http://www.bpost2.be/zipcodes/files/zipcodes_prov_nl.xls