PHP | gethostbyname() Function Last Updated : 29 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The gethostbyname() function is an inbuilt function in PHP which returns IPv4 address for a specified host/domain name. Syntax: string gethostbyname( $hostname ) Parameter: This function accepts single parameter $hostname which is required. It specifies the hostname whose IPv4 address to be found. Return Value: This function returns the IPv4 address on success or string containing the unmodified hostname on failure. Note: This function is available for PHP 4.0.0 and newer versions. Below program illustrates the gethostbyname() function in PHP: Program: php <?php $ip = gethostbyname("geeksforgeeks.org"); echo $ip; ?> Output: 52.25.109.230 Reference: https://www.php.net/manual/en/function.gethostbyname.php Create Quiz Comment G gekcho Follow 0 Improve G gekcho Follow 0 Improve Article Tags : Web Technologies PHP PHP-function Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like