There is an IP - 95.153.128.120 and this IP is converted as it is, the output is 1603895416

With what function and or what else is this IP converted?

  • 2
    ((256 * 95 + 153) * 256 + 128) * 256 + 120 = 1603895416. - Yaant

1 answer 1

php has a function

int ip2long ( string $ip_address ) 

ip2long - Converts a string containing (IPv4) Internet address with dots to an integer (long)

Example

 $long = ip2long($ip); 

Returns an integer or FALSE if the ip_address parameter contains an error.

documentation


and inverse function

 string long2ip ( string $proper_address ) 

long2ip - Converts a long integer address (long integer) into, containing the Internet address of the network (IPv4), a standard string with dots

Returns the Internet IP address as a string.

documentation