public static function uncompress($ip)
	{
		$c1 = -1;
		$c2 = -1;
		if (substr_count($ip, '::') === 1)
		{
			list($ip1, $ip2) = explode('::', $ip);
			if ($ip1 === '')
			{
				$c1 = -1;
			}
			else
			{
				$c1 = substr_count($ip1, ':');
			}
			if ($ip2 === '')
			{
				$c2 = -1;
			}
			else
			{
				$c2 = substr_count($ip2, ':');
			}
			if (strpos($ip2, '.') !== false)
			{
				$c2++;
			}
			// ::
			if ($c1 === -1 && $c2 === -1)
			{
				$ip = '0:0:0:0:0:0:0:0';
			}
			// ::xxx
			else if ($c1 === -1)
			{
				$fill = str_repeat('0:', 7 - $c2);
				$ip = str_replace('::', $fill, $ip);
			}
			// xxx::
			else if ($c2 === -1)
			{
				$fill = str_repeat(':0', 7 - $c1);
				$ip = str_replace('::', $fill, $ip);
			}
			// xxx::xxx
			else
			{
				$fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
				$ip = str_replace('::', $fill, $ip);
			}
		}
		return $ip;
	}
public static function uncompress($ip)
	{
		$c1 = -1;
		$c2 = -1;
		if (substr_count($ip, '::') === 1)
		{
			list($ip1, $ip2) = explode('::', $ip);
			if ($ip1 === '')
			{
				$c1 = -1;
			}
			else
			{
				$c1 = substr_count($ip1, ':');
			}
			if ($ip2 === '')
			{
				$c2 = -1;
			}
			else
			{
				$c2 = substr_count($ip2, ':');
			}
			if (strpos($ip2, '.') !== false)
			{
				$c2++;
			}
			// ::
			if ($c1 === -1 && $c2 === -1)
			{
				$ip = '0:0:0:0:0:0:0:0';
			}
			// ::xxx
			else if ($c1 === -1)
			{
				$fill = str_repeat('0:', 7 - $c2);
				$ip = str_replace('::', $fill, $ip);
			}
			// xxx::
			else if ($c2 === -1)
			{
				$fill = str_repeat(':0', 7 - $c1);
				$ip = str_replace('::', $fill, $ip);
			}
			// xxx::xxx
			else
			{
				$fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
				$ip = str_replace('::', $fill, $ip);
			}
		}
		return $ip;
	}
public static function uncompress ( $ ip ) { $ c1 = - 1 ; $ c2 = - 1 ; if ( substr_count ( $ ip , '::' ) === 1 ) { list ( $ ip1 , $ ip2 ) = explode ( '::' , $ ip ) ; if ( $ ip1 === '' ) { $ c1 = - 1 ; } else { $ c1 = substr_count ( $ ip1 , ':' ) ; } if ( $ ip2 === '' ) { $ c2 = - 1 ; } else { $ c2 = substr_count ( $ ip2 , ':' ) ; } if ( strpos ( $ ip2 , '.' ) !== false ) { $ c2 ++ ; } // :: if ( $ c1 === - 1 && $ c2 === - 1 ) { $ ip = '0:0:0:0:0:0:0:0' ; } // ::xxx else if ( $ c1 === - 1 ) { $ fill = str_repeat ( '0:' , 7 - $ c2 ) ; $ ip = str_replace ( '::' , $ fill , $ ip ) ; } // xxx:: else if ( $ c2 === - 1 ) { $ fill = str_repeat ( ':0' , 7 - $ c1 ) ; $ ip = str_replace ( '::' , $ fill , $ ip ) ; } // xxx::xxx else { $ fill = ':' . str_repeat ( '0:' , 6 - $ c2 - $ c1 ) ; $ ip = str_replace ( '::' , $ fill , $ ip ) ; } } return $ ip ; }
Uncompresses an IPv6 address

RFC 4291 allows you to compress concecutive 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 <alexander.merz@web.de>
@author elfrink at introweb dot nl
@author Josh Peck <jmp at joshpeck dot org>
@copyright 2003-2005 The PHP Group
@license http://www.opensource.org/licenses/bsd-license.php
@param string $ip An IPv6 address
@return string The uncompressed IPv6 address
Uncompresses an IPv6 address