Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

inet_pton

Description

The inet_pton of Network for PHP converts a human readable IP address to its packed in_addr representation.

Syntax

inet_pton ( string $address ) : string

Parameters

address

A human readable IPv4 or IPv6 address.

Return

Returns the in_addr representation of the given address, or FALSE if a syntactically invalid address is given (for example, an IPv4 address without dots or an IPv6 address without colons).

Examples

1

<?

$in_addr = inet_pton('127.0.0.1');
echo "packed:" . $in_addr . "\n";
 
$in6_addr = inet_pton('::1');
echo "packed:" . $in6_addr;

?>
packed:
packed:
HomeMenu