PHP | gethostbyname() Function Last Updated : 29 Aug, 2019 Summarize Comments Improve Suggest changes Share 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 Comment More infoAdvertise with us Next Article PHP | gethostbyname() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | gethostname() Function The gethostname() function is an inbuilt function in PHP which returns the host or domain name for the local machine. This function is applicable after PHP 5.3.0 before that there was another function called php_uname function. Syntax: string gethostname( void ) Parameters: This function doesn't acc 1 min read PHP | gethostnamel() Function The gethostbynamel() function is an inbuilt function in PHP which returns a list of IPv4 address for a specified internet host/domain name. Syntax: gethostbynamel( string $hostname ) Parameters: This function accepts single parameter $hostname which is required. It specifies the hostname whose IPv4 1 min read PHP | getprotobyname() Function The getprotobyname() function is an inbuilt function in PHP which returns the protocol number for a specified protocol name. Syntax: int getprotobyname( string $name ) Parameters: This function accepts single parameter $name which is required. It specifies the protocol name, like tcp, icmp, udp, ip 1 min read PHP | getservbyname() Function The getservbyname() function is an inbuilt function in PHP which returns the port number for given protocol and Internet service. Syntax: int getservbyname( string $service, string $protocol ) Parameters: This function accepts two parameters as mentioned above and described below: $protocol: It is r 2 min read PHP | getprotobynumber() Function The getprotobynumber() function is an inbuilt function in PHP which returns the protocol name for a specified protocol number. Syntax: string getprotobynumber( int $protocol_number ) Parameters: This function accepts single parameter $protocol_number which is required. It specifies the protocol numb 1 min read Like