private function cidr6Match($ip, $range) {
        // Split CIDR on /
        list($subnet, $mask) = explode('/', $range);

        // Convert IP's to their in_addr representations
        $ip = inet_pton($ip);
        $subnet = inet_pton($subnet);

        // Convert the mask
        $mask = $this->getBinaryMask((int) $mask);

        return ($ip & $mask) === $subnet;
    }
private function cidr6Match($ip, $range) {
        // Split CIDR on /
        list($subnet, $mask) = explode('/', $range);

        // Convert IP's to their in_addr representations
        $ip = inet_pton($ip);
        $subnet = inet_pton($subnet);

        // Convert the mask
        $mask = $this->getBinaryMask((int) $mask);

        return ($ip & $mask) === $subnet;
    }
private function cidr6Match ( $ ip , $ range ) { // Split CIDR on / list ( $ subnet , $ mask ) = explode ( '/' , $ range ) ; // Convert IP's to their in_addr representations $ ip = inet_pton ( $ ip ) ; $ subnet = inet_pton ( $ subnet ) ; // Convert the mask $ mask = $ this -> getBinaryMask ( ( int ) $ mask ) ; return ( $ ip & $ mask ) === $ subnet ; }
Check an IPv6 address is in a subnet

@param string $ip The IP address to check (for instance 2001:db8:0:0:0:0:0:0)
@param string $range A CIDR notated IP address and routing prefix (for instance 2001:db8::/48)
@return boolean
Check an IPv6 address is in a subnet