PHP code example of alcohol / iso3166
1. Go to this page and download the library: Download alcohol/iso3166 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alcohol / iso3166 example snippets
php
use Alcohol\ISO3166\ISO3166;
$iso3166 = new ISO3166();
// methods defined by interface Alcohol\ISO3166\DataProvider
$iso3166->getByAlpha2('NL');
$iso3166->getByAlpha3('NLD');
$iso3166->getByNumeric('528');
// methods provided for convenience
$iso3166->getAll();
foreach ($iso3166 as $key => $value) {
// simple iterator implementation using a generator (uses alpha2 for keys)
}
foreach ($iso3166->listBy(ISO3166::KEY_ALPHA3) as $key => $value) {
// use a specific generator to iterate using other available keys
// constants available are KEY_ALPHA2, KEY_ALPHA3, KEY_NUMERIC
}