src/IPAddress.php
public function withMask(IPAddressInterface $mask): IPAddressInterface
    {
        $octets = $this->getParts();
        $maskOctets = $mask->getParts();

        for ($i = 0; $i < 4; $i++) {
            $octets[$i] = $octets[$i] & $maskOctets[$i];
        }

        return new self($octets);
    }
public function withMask(IPAddressInterface $mask): IPAddressInterface
    {
        $octets = $this->getParts();
        $maskOctets = $mask->getParts();

        for ($i = 0; $i < 4; $i++) {
            $octets[$i] = $octets[$i] & $maskOctets[$i];
        }

        return new self($octets);
    }
public function withMask ( IPAddressInterface $ mask ) : IPAddressInterface { $ octets = $ this -> getParts ( ) ; $ maskOctets = $ mask -> getParts ( ) ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) { $ octets [ $ i ] = $ octets [ $ i ] & $ maskOctets [ $ i ] ; } return new self ( $ octets ) ; }
Returns a copy of the IP address instance masked with the specified mask.

@since 1.0.0

@param IPAddressInterface $mask The mask.

@return IPAddressInterface The IP address instance.
Returns a copy of the IP address instance masked with the specified mask .