protected function applyIpV6Mask($ip, $maskLength):string
    {
        $masks = ['ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'ffff:ffff:ffff:ffff::', 'ffff:ffff:ffff:0000::', 'ffff:ff00:0000:0000::'];
        $packedAddress = inet_pton($masks[$maskLength]);
        $binaryString = pack('a16', $packedAddress);
        return (string)($ip & $binaryString);
    }
protected function applyIpV6Mask($ip, $maskLength):string
    {
        $masks = ['ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'ffff:ffff:ffff:ffff::', 'ffff:ffff:ffff:0000::', 'ffff:ff00:0000:0000::'];
        $packedAddress = inet_pton($masks[$maskLength]);
        $binaryString = pack('a16', $packedAddress);
        return (string)($ip & $binaryString);
    }
protected function applyIpV6Mask ( $ ip , $ maskLength ) : string { $ masks = [ 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff' , 'ffff:ffff:ffff:ffff::' , 'ffff:ffff:ffff:0000::' , 'ffff:ff00:0000:0000::' ] ; $ packedAddress = inet_pton ( $ masks [ $ maskLength ] ) ; $ binaryString = pack ( 'a16' , $ packedAddress ) ; return ( string ) ( $ ip & $ binaryString ) ; }
Apply a mask filter on the ip v6 address.

@param string $ip
@param int $maskLength
@return string
Apply a mask filter on the ip v6 address .