I18N_ISO_3166 class provides common methods for converting between and retrieving the country name by ISO 3166 standard country codes, including the two letter, three letter, and three number codes.

What is ISO 3166?

Description taken from ISO website:

ISO 3166 is the International Standard for country codes. The purpose of ISO 3166 is to establish codes for the representation of names of countries, territories or areas of geographical interest, and their subdivisions.

Example code

Proper documentation to be written. In the meanwhile these straightforward examples will server as documentation.


require_once('I18N/ISO/3166.php');
$i = new I18N_ISO_3166('FI');
print $i->getTwoLetterCode() . "\n";
print $i->getThreeLetterCode() . "\n";
print $i->getNumber() . "\n";
print $i->getCountry() . "\n\n";
print "FI  " . $i->getTwoLetterCode('FI') . "\n";
print "FIN " . $i->getTwoLetterCode('FIN') . "\n";
print "246 " . $i->getTwoLetterCode('246') . "\n\n";
print "FIN " . $i->getThreeLetterCode('FIN') . "\n";
print "FI  " . $i->getThreeLetterCode('FI') . "\n";
print "246 " . $i->getThreeLetterCode('246') . "\n\n";
print "FIN " . $i->getNumber('FIN') . "\n";
print "FI  " . $i->getNumber('FI') . "\n";
print "246 " . $i->getNumber('246') . "\n\n";
print "FIN " . $i->getCountry('FIN') . "\n";
print "FI  " . $i->getCountry('FI') . "\n";
print "246 " . $i->getCountry('246') . "\n\n";

Installation

Before installing you might want to see the source. Install with PEAR commandline installer by issuing command:


pear install http://www.appelsiini.net/~tuupola/download/I18N_ISO_3166-0.3.0.tgz 

Upgrade with PEAR commandline installer by issuing command:


pear upgrade http://www.appelsiini.net/~tuupola/download/I18N_ISO_3166-0.3.0.tgz