Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

PHP | gethostnamel() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 address list to be found.

Return Value: This function returns the list of IPv4 address of the specified host/domain name on success or FALSE on failure.

Note: This function is available for PHP 4.0.0 and newer version.

Below program illustrates the gethostbynamel() function in PHP:

Program:




<?php
$hostlist = gethostbynamel("geeksforgeeks.org");
print_r($hostlist);
?>


Output:

Array ( [0] => 52.25.109.230 )

Reference: https://www.php.net/manual/en/function.gethostbynamel.php

My Personal Notes arrow_drop_up
Last Updated : 29 Aug, 2019
Like Article
Save Article
Similar Reads
Related Tutorials