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

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP inet_pton() Function Usage and Example

PHP HTTP Reference Manual

The inet_pton() function converts human-readable IP addresses to a compressed in_addr representation

Syntax

string inet_pton ( string $address )

Definition and Usage

It is used to convert human-readable IP addresses to in_addr format

Return Value

It returns an in_addr address, otherwise it will display a failure message.

Parameter

NumberParameters and Description
1

address

It includes IPv4or IPv6Address.

Online Example

Try the following example

<?php
   $in_addr = inet_pton('127.0.0.1');
?>

The following code converts an IP address to an address in the in_addr format.

PHP HTTP Reference Manual