PHP code example of deft / iso3166-utility
1. Go to this page and download the library: Download deft/iso3166-utility 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/ */
deft / iso3166-utility example snippets
$util = new Deft\ISO3166\CountryCodeUtility();
print $util->convertAlpha2ToAlpha3('NL'); // Outputs 'NLD'
print $util->convertAlpha3ToAlpha2('NLD'); // Outputs 'NL';
// Converting non-existing country codes will result in null
$util->convertAlpha3ToAlpha2('FOO'); // Returns null
// You can provide a custom country code list by passing the path as the first
// constructor argument. The file should be tab separated ("NL\tNLD\n")
$utilCustom = new Deft\ISO3166\CountryCodeUtility('custom_country_code_list.txt');