PHP | geoip_db_filename() Function Last Updated : 13 Sep, 2018 Comments Improve Suggest changes Like Article Like Report 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 database. Syntax: string geoip_db_filename ( $database ) Parameter: This function accepts single parameter $database which is mandatory. The database type are integer. There are various predefined constants which are used as database listed below: GEOIP_COUNTRY_EDITION GEOIP_REGION_EDITION_REV0 GEOIP_CITY_EDITION_REV0 GEOIP_ORG_EDITION GEOIP_ISP_EDITION GEOIP_CITY_EDITION_REV1 GEOIP_REGION_EDITION_REV1 GEOIP_PROXY_EDITION GEOIP_ASNUM_EDITION GEOIP_NETSPEED_EDITION GEOIP_DOMAIN_EDITION The following constants are used for net speed: GEOIP_UNKNOWN_SPEED GEOIP_DIALUP_SPEED GEOIP_CABLEDSL_SPEED GEOIP_CORPORATE_SPEED Return Value: This function returns the filename of the corresponding GeoIP database on success or NULL on failure/error. Below programs illustrate the geoip_db_filename() function in PHP: Program 1: php <?php // PHP code implementing the geoip_db_filename() function // The function takes the database and returns // the filename according to the database print geoip_db_filename(GEOIP_COUNTRY_EDITION); ?> Output: /usr/share/GeoIP/GeoIP.dat Program 2: php <?php $arr = array( 'GEOIP_COUNTRY_EDITION' => GEOIP_COUNTRY_EDITION, 'GEOIP_REGION_EDITION_REV1' => GEOIP_REGION_EDITION_REV1, 'GEOIP_PROXY_EDITION' => GEOIP_PROXY_EDITION, 'GEOIP_ASNUM_EDITION' => GEOIP_ASNUM_EDITION, 'GEOIP_DOMAIN_EDITION' => GEOIP_DOMAIN_EDITION, 'EOIP_UNKNOWN_SPEED' => GEOIP_UNKNOWN_SPEED, 'GEOIP_DIALUP_SPEED' => GEOIP_DIALUP_SPEED, 'GEOIP_CABLEDSL_SPEED' => GEOIP_CABLEDSL_SPEED, 'GEOIP_CORPORATE_SPEED' => GEOIP_CORPORATE_SPEED ); foreach ($arr as $val) { echo geoip_db_filename($val) . (geoip_db_avail($val) ? 'Available':'') . '<br>'; } ?> Output: /usr/share/GeoIP/GeoIP.datAvailable /usr/share/GeoIP/GeoIPRegion.dat /usr/share/GeoIP/GeoIPProxy.dat /usr/share/GeoIP/GeoIPASNum.dat /usr/share/GeoIP/GeoIPDomain.dat /usr/share/GeoIP/GeoIP.datAvailable /usr/share/GeoIP/GeoIPCity.dat /usr/share/GeoIP/GeoIPRegion.dat Related Articles: PHP | geoip_country_code_by_name() Function PHP | geoip_continent_code_by_name() Function Reference: http://php.net/manual/en/function.geoip-db-filename.php Comment More infoAdvertise with us Next Article PHP | geoip_db_filename() Function P priya_1998 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | fileatime( ) Function The fileatime() function in PHP is an inbuilt function which is used to return the last access time of a specified file. The fileatime() function returns the last access time of a file as a Unix Timestamp on success and False on failure. The filename is passed as a parameter to the fileatime() funct 2 min read PHP is_file( ) Function The is_file() function in PHP is an inbuilt function which is used to check whether the specified file is a regular file or not. The name of the file is sent as a parameter to the is_file() function and it returns True if the file is a regular file else it returns False. Syntax: bool is_file($file) 2 min read PHP | geoip_db_avail() Function The geoip_db_avail() function is an inbuilt function in PHP which is used to check whether a GeoIP database is available or not. The function does not consider the proper existence of a file instead it checks whether it is readable or not. Syntax: bool geoip_db_avail( $database ) Parameters: This fu 2 min read PHP fileinode() Function The fileinode() function is an inbuilt function in PHP that returns the inode of the file. Syntax: fileinode(string $filename): int|falseParameter: This function has only one parameter: filename: This parameter specifies the path for the particular file.Return Value: This function returns the inode 1 min read PHP file_get_contents() Function In this article, we will see how to read the entire file into a string using the file_get_contents() function, along with understanding their implementation through the example.The file_get_contents() function in PHP is an inbuilt function that is used to read a file into a string. The function uses 3 min read Like