original_string: public static function compressIPv6($address) {
  			// use PHP-function if PHP was compiled with IPv6-support
  		if (defined('AF_INET6')) {
  			$bin = inet_pton($address);
  			$address = inet_ntop($bin);
  		} else {
  			$address = self::normalizeIPv6($address);
  
  				// append one colon for easier handling
  				// will be removed later
  			$address .= ':';
  
  				// according to IPv6-notation the longest match
  				// of a package of '0000:' may be replaced with ':'
  				// (resulting in something like '1234::abcd')
  			for ($counter = 8; $counter > 1; $counter--) {
  				$search = str_repeat('0000:', $counter);
  				if (($pos = strpos($address, $search)) !== FALSE) {
  					$address = substr($address, 0, $pos) . ':' . substr($address, $pos + ($counter*5));
  					break;
  				}
  			}
  
  				// up to 3 zeros in the first part may be removed
  			$address = preg_replace('/^0{1,3}/', '', $address);
  				// up to 3 zeros at the beginning of other parts may be removed
  			$address = preg_replace('/:0{1,3}/', ':', $address);
  
  				// strip last colon (from chunk_split)
  			$address = substr($address, 0, -1);
  		}
  		return $address;
  	}
code: public static function compressIPv6($address) {
  			// use PHP-function if PHP was compiled with IPv6-support
  		if (defined('AF_INET6')) {
  			$bin = inet_pton($address);
  			$address = inet_ntop($bin);
  		} else {
  			$address = self::normalizeIPv6($address);
  
  				// append one colon for easier handling
  				// will be removed later
  			$address .= ':';
  
  				// according to IPv6-notation the longest match
  				// of a package of '0000:' may be replaced with ':'
  				// (resulting in something like '1234::abcd')
  			for ($counter = 8; $counter > 1; $counter--) {
  				$search = str_repeat('0000:', $counter);
  				if (($pos = strpos($address, $search)) !== FALSE) {
  					$address = substr($address, 0, $pos) . ':' . substr($address, $pos + ($counter*5));
  					break;
  				}
  			}
  
  				// up to 3 zeros in the first part may be removed
  			$address = preg_replace('/^0{1,3}/', '', $address);
  				// up to 3 zeros at the beginning of other parts may be removed
  			$address = preg_replace('/:0{1,3}/', ':', $address);
  
  				// strip last colon (from chunk_split)
  			$address = substr($address, 0, -1);
  		}
  		return $address;
  	}
code_tokens: public static function compressIPv6 ( $ address ) { // use PHP-function if PHP was compiled with IPv6-support if ( defined ( 'AF_INET6' ) ) { $ bin = inet_pton ( $ address ) ; $ address = inet_ntop ( $ bin ) ; } else { $ address = self :: normalizeIPv6 ( $ address ) ; // append one colon for easier handling // will be removed later $ address .= ':' ; // according to IPv6-notation the longest match // of a package of '0000:' may be replaced with ':' // (resulting in something like '1234::abcd') for ( $ counter = 8 ; $ counter > 1 ; $ counter -- ) { $ search = str_repeat ( '0000:' , $ counter ) ; if ( ( $ pos = strpos ( $ address , $ search ) ) !== FALSE ) { $ address = substr ( $ address , 0 , $ pos ) . ':' . substr ( $ address , $ pos + ( $ counter * 5 ) ) ; break ; } } // up to 3 zeros in the first part may be removed $ address = preg_replace ( '/^0{1,3}/' , '' , $ address ) ; // up to 3 zeros at the beginning of other parts may be removed $ address = preg_replace ( '/:0{1,3}/' , ':' , $ address ) ; // strip last colon (from chunk_split) $ address = substr ( $ address , 0 , - 1 ) ; } return $ address ; }
docstring: Compress an IPv6 address to the shortest notation
  
  @param string $address Given IPv6 address
  @return string Compressed address
  @see normalizeIPv6()
docstring_tokens: Compress an IPv6 address to the shortest notation