Lines Matching defs:ip
78 * @param string $ip An IPv6 address
81 public static function uncompress($ip)
85 if (substr_count($ip, '::') === 1) {
86 [$ip1, $ip2] = explode('::', $ip);
102 $ip = '0:0:0:0:0:0:0:0';
107 $ip = str_replace('::', $fill, $ip);
112 $ip = str_replace('::', $fill, $ip);
117 $ip = str_replace('::', $fill, $ip);
120 return $ip;
134 * @param string $ip An IPv6 address
137 public static function compress($ip)
140 $ip = self::uncompress($ip);
141 $ip_parts = self::split_v6_v4($ip);
176 * @param string $ip An IPv6 address
179 private static function split_v6_v4($ip)
181 if (strpos($ip, '.') !== false) {
182 $pos = strrpos($ip, ':');
183 $ipv6_part = substr($ip, 0, $pos);
184 $ipv4_part = substr($ip, $pos + 1);
188 return [$ip, ''];
196 * @param string $ip An IPv6 address
197 * @return bool true if $ip is a valid IPv6 address
199 public static function check_ipv6($ip)
201 $ip = self::uncompress($ip);
202 [$ipv6, $ipv4] = self::split_v6_v4($ip);
249 * @param string $ip An IPv6 address
250 * @return bool true if $ip is a valid IPv6 address
252 public static function checkIPv6($ip)
254 return self::check_ipv6($ip);