\IPFormatIPFormat

Summary

Methods
Properties
Constants
ip_to_long()
long_to_ip()
ipv4_to_ipv6()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

ip_to_long()

ip_to_long(string  $ip_address) : string|integer

IP to long.

Convert a given IP address (v4 or v6) to its 'long integer' representation.

Parameters

string $ip_address

IPv4 or IPv6 address.

Returns

string|integer —

Long integer representation of the address.

long_to_ip()

long_to_ip(  $long) : string

Long to IP.

Convert a long integer to its IPv4 or IPv6 counterpart.

Parameters

$long

Returns

string —

IPv4 or IPv6 address.

ipv4_to_ipv6()

ipv4_to_ipv6(string  $ip_address, string  $type = 'compressed') 

IPv4 to IPv6 address.

Convert an IPv4 address to one of the IPv6 formats (compressed, shortened or expanded)

Parameters

string $ip_address

An IPv4 address.

string $type

Type of resulting IPv6 address (compressed by default).