PHP Classes


Recommend this page to a friend!
  Classes of Peter Kahl   PHP Country Code to Country Name   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Country Code to Country Name
Validate country code and get the respective name
Author: By
Last change: Update of
Date: 4 years ago
Size: 883 bytes


Class file image Download


Downloads License If this project has business value for you then don't hesitate to support me with a small donation.

Methods for working with 2-character country codes (validation, name from code).


When using method getName(), multibyte strings will be returned.

Usage Exaples

use peterkahl\CountryCode\CountryCode;

# Validate a country code string:
if (CountryCode::isValid('uk'))
  echo 'valid';
  echo 'invalid';

# Get name from country code:
echo CountryCode::getName('RE'); # Réunion