PHP code example of jinas / iso-3166

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

    

jinas / iso-3166 example snippets


use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereAlpha2('no'));

/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereAlpha3('nor'));
/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereNumeric(578));
/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/

use Jinas\ISO\ISO3166;

$iso = new ISO3166;
var_dump($iso->whereCountry("norway"));

/* Returns:
  {
    country: 'Norway',
    alpha2: 'NO',
    alpha3: 'NOR',
    numeric: '578'
  }
*/