• PHP Video Tutorials

PHP - Function long2ip



Syntax

string long2ip ( string $proper_address )

Definition and Usage

It used to convert long integer value to Ipv4 address.

Return Values

It Returns IP address as a string

Parameters

Sr.No Parameters & Description
1

proper_address

it contains Long integer value

Example

Try out following example

<?php
  $ip = "49.204.34.96";
  $s32int = ip2long($ip);
  $us32str = sprintf("%u",$s32int);
  
  printf("%s %s",$us32str,long2ip(-(4294967296-$us32str)));
?>

The Above code convert the ip address to long integer and long integer to IP address

835461728 49.204.34.96
php_function_reference.htm
Advertisements