English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP tutorial

Advanced PHP tutorial

PHP & MySQL

PHP reference manual

Usage and example of PHP gethostbynamel() function

PHP HTTP  reference manual

The gethostbynamel() function retrieves the list of IPv4 addresses corresponding to the Internet hostname.

Syntax

array gethostbynamel ( string $hostname )

Definition and usage

It is used to obtain the list of IPV4 addresses specified by the hostname

Return value

 Returns an array of IPv4 addresses, or FALSE if hostname cannot be resolved.

Parameter

Serial numberParameters and descriptions
1

hostname

Hostname

Online example

Try the following example

<?php
   $hosts = gethostbynamel('ru.oldtoolbag.com');
   
   print_r($hosts);
?>

The above example gives the following result

Array ( [0] => 39.107.75.220 )

PHP HTTP  reference manual