Class to validate and to work with IPv6 addresses
This was originally based on the PEAR class of the same name, but has been entirely rewritten.
package | Requests |
---|---|
subpackage | Utilities |
check_ipv6(string $ip) : boolean
Checks if the given IP is a valid IPv6 address
string
An IPv6 address
boolean
true if $ip is a valid IPv6 addresscompress(string $ip) : string
RFC 4291 allows you to compress consecutive zero pieces in an address to '::'. This method expects a valid IPv6 address and compresses consecutive zero pieces to '::'.
Example: FF01:0:0:0:0:0:0:101 -> FF01::101 0:0:0:0:0:0:0:1 -> ::1
see |
---|
string
An IPv6 address
string
The compressed IPv6 addressuncompress(string $ip) : string
RFC 4291 allows you to compress consecutive zero pieces in an address to '::'. This method expects a valid IPv6 address and expands the '::' to the required number of zero pieces.
Example: FF01::101 -> FF01:0:0:0:0:0:0:101 ::1 -> 0:0:0:0:0:0:0:1
author | Alexander Merz |
---|---|
author | elfrink at introweb dot nl |
author | Josh Peck |
copyright | 2003-2005 The PHP Group |
license | http://www.opensource.org/licenses/bsd-license.php |
string
An IPv6 address
string
The uncompressed IPv6 addresssplit_v6_v4(string $ip) : array<mixed,string>
RFC 4291 allows you to represent the last two parts of an IPv6 address using the standard IPv4 representation
Example: 0:0:0:0:0:0:13.1.68.3 0:0:0:0:0:FFFF:129.144.52.38
string
An IPv6 address
array<mixed,string>
[0] contains the IPv6 represented part, and [1] the IPv4 represented part