PHP code example of zhuravel / php-iso-3166-1

1. Go to this page and download the library: Download zhuravel/php-iso-3166-1 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/ */

    

zhuravel / php-iso-3166-1 example snippets



ada1 = getTwoCharacterCountries()['CA'];
$canada2 = getThreeCharacterCountries()['CAN'];
$canada3 = getNumericCountryCodes()['124'];

var_dump($canada1, $canada2, $canada3);


ach (getTwoCharacterCountries() as $code => $name) {
    echo sprintf("%s %s\n", $code, $name);
}


Iso\Countries\Factory\ISO3166CountryFactory;

$factory = new ISO3166CountryFactory();

$canada = $factory->fromAlphaTwoCode('CA');

var_dump($canada);