PHP | geoip_country_code_by_name() Function Last Updated : 03 Jul, 2018 Comments Improve Suggest changes Like Article Like Report The geoip_country_code_by_name() is an inbuilt function in PHP which helps to generate the two-letter country code (Each country is assigned a two-letter country code. For Example: US for United States). The function takes the hostname or IP Address as an argument and generates the two letter country code. Syntax : string geoip_country_code_by_name ( string $hostname ) Parameters : The function geoip_country_code_by_name() accepts a single parameter as mentioned above and explained below. $hostname : This is the only parameter accepted by the above function . This is the IP address or the hostname which the function accepts and returns the two letter country code . Return Values : It returns a two letter ISO country code on success otherwise returns FALSE on Failure. Below programs illustrate the geoip_country_code_by_name() function : Program 1: php <?php // PHP code implementing the // geoip_country_code_by_name() function // The function takes the hostname // 'www.example.com' as an argument $country = geoip_country_code_by_name('www.example.com'); if ($country) { // displays the two letter ISO country code echo 'This host is located in: ' . $country; } ?> Output: This host is located in: US Program 2: php <?php // PHP code implementing the // geoip_country_code_by_name() function // The function takes the hostname // 'www.example.com' as an argument $country = geoip_country_code_by_name('www.geeksforgeeks.org'); if ($country) { // displays the two letter ISO country code echo 'This host is located in: ' . $country; } ?> Output: This host is located in: US Reference : http://php.net/manual/en/function.geoip-country-code-by-name.php Comment More infoAdvertise with us Next Article PHP | geoip_country_code_by_name() Function P priya_1998 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | geoip_continent_code_by_name() Function The geoip_continent_code_by_name() function is an inbuilt function in PHP which helps to generate a two-letter continent code(Each continent has assigned a two-letter code. For example - AF for Africa, AS for Asia, and many more). The function takes the hostname or IP Address as an argument and gene 1 min read PHP | geoip_isp_by_name() Function The geoip_isp_by_name() is an inbuilt function in PHP , which helps to get the ISP(Internet Service Provider) of the corresponding IP address .The function is available only for a commercial GeoIP ISP Edition user and gives a warning if the database is not found . Syntax : string geoip_isp_by_name ( 1 min read PHP | geoip_asnum_by_name() Function The geoip_asnum_by_name() is an inbuilt function in PHP which helps us to get the Autonomous System Number (ASN). The function will help us to get the ASN by taking an IP address as an argument . Syntax : string geoip_asnum_by_name ( string $hostname ) Parameters : The function accepts a single para 1 min read PHP | geoip_db_filename() Function The geoip_db_filename() function is an inbuilt function in PHP, which is used to generate the filename for corresponding GeoIP database accepted as a parameter. The function will not indicate the existence of file on the disk instead will just return the filename where the library is searching the d 2 min read PHP | DateTimeZone::getName() Function The DateTimeZone::getName() function is an inbuilt function in PHP which is used to return the name of the created timezone. Syntax: DateTimeZone::getName() Parameters: This function does not accept any parameter. Return Values:: This function return the name of the created timezone. Below programs 1 min read Like