PHP code example of writecrow / country_code_converter

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

    

writecrow / country_code_converter example snippets


echo CountryCodeConverter::convert('AL');
// Will print 'Albania'

echo CountryCodeConverter::convert('ALB');
// Will print 'Albania'

echo CountryCodeConverter::convert('008');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania');
// Will print 'AL'

echo CountryCodeConverter::convert('Albania', 'name');
// Will print 'Albania'

echo CountryCodeConverter::convert('Albania', 'two-digit');
// Will print 'AL'

echo CountryCodeConverter::convert('Albania', 'three-digit');
// Will print 'ALB'

echo CountryCodeConverter::convert('Albania', 'numeric');
// Will print '008'