public function getSubBlocks($prefix): IPBlockIterator
    {
        $prefix = ltrim($prefix, '/');
        $this->checkPrefix($prefix);

        if ($prefix <= $this->prefix) {
            throw new \InvalidArgumentException("Prefix must be smaller than {$this->prefix} ($prefix given)");
        }

        $first_block = new static($this->first_ip, $prefix);
        $number_of_blocks = gmp_pow(2, $prefix - $this->prefix);

        return new IPBlockIterator($first_block, $number_of_blocks);
    }
public function getSubBlocks($prefix): IPBlockIterator
    {
        $prefix = ltrim($prefix, '/');
        $this->checkPrefix($prefix);

        if ($prefix <= $this->prefix) {
            throw new \InvalidArgumentException("Prefix must be smaller than {$this->prefix} ($prefix given)");
        }

        $first_block = new static($this->first_ip, $prefix);
        $number_of_blocks = gmp_pow(2, $prefix - $this->prefix);

        return new IPBlockIterator($first_block, $number_of_blocks);
    }
public function getSubBlocks ( $ prefix ) : IPBlockIterator { $ prefix = ltrim ( $ prefix , '/' ) ; $ this -> checkPrefix ( $ prefix ) ; if ( $ prefix <= $ this -> prefix ) { throw new \ InvalidArgumentException ( "Prefix must be smaller than {$this->prefix} ($prefix given)" ) ; } $ first_block = new static ( $ this -> first_ip , $ prefix ) ; $ number_of_blocks = gmp_pow ( 2 , $ prefix - $ this -> prefix ) ; return new IPBlockIterator ( $ first_block , $ number_of_blocks ) ; }
Split the block into smaller blocks.

Returns an iterator, use foreach to loop it and count to get number of subnets.

@param mixed $prefix

@return IPBlockIterator
Split the block into smaller blocks .