PHP inet_ntop() Function

❮ PHP Network Reference

Example

Convert a packed address into a readable format:

<?php
$addr = chr(127) . chr(0) . chr(1) . chr(1);
$exp = inet_ntop($addr);
echo $exp;
?>
Try it Yourself »

Definition and Usage

The inet_ntop() function converts a 32bit IPv4 or 128bit IPv6 address into a readable format.

Syntax

inet_ntop(address)

Parameter Values

Parameter Description
address Required. Specifies a 32bit IPv4 or 128bit IPv6 address

Technical Details

Return Value: A human readable address on success. FALSE on failure
PHP Version: 5.1+
PHP Changelog: PHP 5.3: Now available on Windows platforms

❮ PHP Network Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.