Net_IPv6::uncompress()

Net_IPv6::uncompress() – Uncompresses an IPv6 address

Synopsis

require_once 'Net/IPv6.php';

string Net_IPv6::uncompress ( string $ip , boolean $leadingZeros = false )

Description

Uncompresses an IPv6 address. RFC 2373 allows you to compress zeros in an address to '::'. This function expects an valid IPv6 address and expands the '::' to the required zeros.

FF01::101	->  FF01:0:0:0:0:0:0:101
      ::1       ->  0:0:0:0:0:0:0:1

Since version 1.2.1, the method can return the address in a nice format where each part of the address has a fixed length of 4 characters. To enable this, you must set $leadingZeros to true.

Parameter

  • string $ip - the IP address to uncompress

  • boolean $leadingZeros - if true, the uncompressed address has a fixed length

Return value

string - the uncompressed IP is an IPv6 address

Note

This function can be called statically.

compress an IPv6 address (Previous) Returns the type of an IP address (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.