PHP code example of hollodotme / iso-country-codes
1. Go to this page and download the library: Download hollodotme/iso-country-codes 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/ */
hollodotme / iso-country-codes example snippets
declare(strict_types=1);
use hollodotme\ISO\CountryCodes\CountryCode;
$countryCode = CountryCode::fromEnglishShortName( 'New Caledonia' );
echo $countryCode->getEnglishShortName(), "\n";
echo $countryCode->getFrenchShortName(), "\n";
echo $countryCode->getAlpha2Code(), "\n";
echo $countryCode->getAlpha3Code(), "\n";
echo $countryCode->getNumericCode();
declare(strict_types=1);
use hollodotme\ISO\CountryCodes\CountryCode;
$countryCode = CountryCode::fromFrenchShortName( 'Nouvelle-Calédonie (la)' );
echo $countryCode->getEnglishShortName(), "\n";
echo $countryCode->getFrenchShortName(), "\n";
echo $countryCode->getAlpha2Code(), "\n";
echo $countryCode->getAlpha3Code(), "\n";
echo $countryCode->getNumericCode();
declare(strict_types=1);
use hollodotme\ISO\CountryCodes\CountryCode;
$countryCode = CountryCode::fromAlpha2Code( 'NC' );
echo $countryCode->getEnglishShortName(), "\n";
echo $countryCode->getFrenchShortName(), "\n";
echo $countryCode->getAlpha2Code(), "\n";
echo $countryCode->getAlpha3Code(), "\n";
echo $countryCode->getNumericCode();
declare(strict_types=1);
use hollodotme\ISO\CountryCodes\CountryCode;
$countryCode = CountryCode::fromAlpha3Code( 'NCL' );
echo $countryCode->getEnglishShortName(), "\n";
echo $countryCode->getFrenchShortName(), "\n";
echo $countryCode->getAlpha2Code(), "\n";
echo $countryCode->getAlpha3Code(), "\n";
echo $countryCode->getNumericCode();
declare(strict_types=1);
use hollodotme\ISO\CountryCodes\CountryCode;
$countryCode = CountryCode::fromNumericCode( '540' );
echo $countryCode->getEnglishShortName(), "\n";
echo $countryCode->getFrenchShortName(), "\n";
echo $countryCode->getAlpha2Code(), "\n";
echo $countryCode->getAlpha3Code(), "\n";
echo $countryCode->getNumericCode();