inet_ntop()


string inet_ntop ( string $str )

Description

inet_ntop() converts a string IP(IPv4) address to a human-readable IP address

※ available F/W version : all

Parameters

Return values

Returns a human-readable IP address string or FALSE on invalid IP address. Otherwise PHP error

Example

<?php
$ip1 = "192.168.0.100";
hexdump($ip1);  // OUTPUT: 0000  31 39 32 2e 31 36 38 2e  30 2e 31 30 30           |192.168.0.100   |
$ip2 = inet_pton($ip1);
hexdump($ip2);  // OUTPUT: 0000  c0 a8 00 64                                       |...d            |
$ip1 = inet_ntop($ip2);
hexdump($ip1);  // OUTPUT: 0000  31 39 32 2e 31 36 38 2e  30 2e 31 30 30           |192.168.0.100   |
?>

See also

inet_pton()

Remarks

This function is identical to the PHP group’s inet_ntop().