Net_IPv6::compress() – compress an IPv6 address


require_once 'Net/IPv6.php';

string Net_IPv6::compress ( string $ip )


Compresses an IPv6 address. RFC 2373 allows you to compress zeros in an address to '::'. This function expects an valid IPv6 address and compresses successive zeros to '::'

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


  • string $ip - the IP address to compress

Return value

string - the compressed IP is an IPv6 address


This function can be called statically.

Validation of IPv6 addresses (Previous) Uncompresses an IPv6 address (Next)
Last updated: Sun, 19 Dec 2010 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.