Skip to content

Instantly share code, notes, and snippets.

@marlenesco
Last active September 21, 2018 15:10
Show Gist options
  • Save marlenesco/30150259c37021b35ae1aac7ee4f6dce to your computer and use it in GitHub Desktop.
Save marlenesco/30150259c37021b35ae1aac7ee4f6dce to your computer and use it in GitHub Desktop.
ZipCode pattern generator
<?php
$patterns = [];
$data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data'), true);
$countries = explode('~', $data['countries']);
foreach ($countries as $country) {
$data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data/'.$country), true);
if (isset($data['zip'])) {
$patterns[$country] = $data['zip'];
}
}
var_export($patterns);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment