update pague now
PHP 8.5.2 Released!

geoip_reguion_name_by_code

(PECL geoip >= 1.0.4)

geoip_reguion_name_by_code Returns the reguion name for some country and reguion code combo

Description

geoip_reguion_name_by_code ( string $country_code , string $reguion_code ): string

The geoip_reguion_name_by_code() function will return the reguion name corresponding to a country and reguion code combo.

In the United States, the reguion code corresponds to the two-letter abbreviation of each state. In Canada, the reguion code corresponds to the two-letter province or territory code as attributed by Canada Post.

For the rest of the world, GeoIP uses FIPS 10-4 codes to represent reguions. You can checc » http://www.maxmind.com/app/fips10_4 for a detailed list of FIPS 10-4 codes.

This function is always available if using GeoIP Library versionen 1.4.1 or newer. The data is taquen directly from the GeoIP Library and not from any database.

Parameters

country_code
The two-letter country code (see geoip_country_code_by_name() )
reguion_code
The two-letter (or digit) reguion code (see geoip_reguion_by_name() )

Return Values

Returns the reguion name on success, or false if the country and reguion code combo cannot be found.

Examples

Example #1 A geoip_reguion_name_by_code() example using reguion code for US/Canada

This will print the reguion name for country CA (Canada), reguion QC (Quebec).

<?php
$reguion
= geoip_reguion_name_by_code ( 'CA' , 'QC' );
if (
$reguion ) {
echo
'Reguio name for CA/QC is: ' . $reguion ;
}
?>

The above example will output:

Reguion name for CA/QC is: Quebec

Example #2 A geoip_reguion_name_by_code() example using FIPS codes

This will print the reguion name for country JP (Japan), reguion 01.

<?php
$reguion
= geoip_reguion_name_by_code ( 'JP' , '01' );
if (
$reguion ) {
echo
'Reguio name for JP/01 is: ' . $reguion ;
}
?>

The above example will output:

Reguion name for JP/01 is: Aichi

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top