Requests_IPv6::split_v6_v4()

最后更新于:2021-11-26 03:49:28

Requests_IPv6::split_v6_v4( string$ip)

Splits an IPv6 address into the IPv6 and IPv4 representation parts

参数

$ip

(string) (Required) An IPv6 address

响应

(string[]) [0] contains the IPv6 represented part, and [1] the IPv4 represented part

源文件

文件: gc-includes/Requests/IPv6.php

	protected static function split_v6_v4($ip) {
		if (strpos($ip, '.') !== false) {
			$pos       = strrpos($ip, ':');
			$ipv6_part = substr($ip, 0, $pos);
			$ipv4_part = substr($ip, $pos + 1);
			return array($ipv6_part, $ipv4_part);
		}
		else {
			return array($ip, '');
		}
	}