Menu Home

gethostbyname

osbo.com | PHP | Functions | gethostbyname

Get the IPv4 address corresponding to a given Internet host name

Syntax

gethostbyname ( string $hostname ) : string

Parameters

hostname

The host name.

Return

Returns the IPv4 address or a string containing the unmodified hostname on failure.

Examples

<?

$hostname = 'php.net';

$return = gethostbyname($hostname);

echo $return;

?>
185.85.0.29

PHP