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

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP gethostbynamel() Function Usage and Example

PHP HTTP Reference Manual

The gethostbynamel() function retrieves the IPv corresponding to the internet hostname4 List of addresses.

Syntax

array gethostbynamel ( string $hostname )

Definition and Usage

It is used to obtain the IPv of the host specified by the hostname4List of addresses

Return Value

 Returns IPv4 Array of addresses, or FALSE is returned when hostname cannot be resolved.

Parameter

NumberParameters and Description
1

hostname

Hostname

Online Example

Try the following example

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

The following results are given by the example above

Array ( [0] => 39.107.75.220)

PHP HTTP Reference Manual