• PHP Video Tutorials

geoip_country_code_by_name()



The geoip_country_code_by_name() function can get the two letter country code.

Syntax

string geoip_country_code_by_name( string $hostname )

The geoip_country_code_by_name() function can return the two letter country code corresponding to hostname or IP address.

Example

<?php
   $country = geoip_country_code_by_name("www.tutorialspoint.com");
   if($country) {
      echo "This host is located in:" . $country;
   }
?>
php_function_reference.htm
Advertisements