src/Subnet.php
public function next() {
        if (!isset($this->current)) {
            throw new BadMethodCallException('You need to call method "load()" first.');
        }

        for ($ipLong = $this->current; $ipLong <= $this->last; $ipLong++) {
            $this->current = $ipLong;

            if ($this->isUsed($ipLong) === false) {
                return long2ip($ipLong);
            }
        }

        throw new RuntimeException('No free IP addresses left');
    }
public function next() {
        if (!isset($this->current)) {
            throw new BadMethodCallException('You need to call method "load()" first.');
        }

        for ($ipLong = $this->current; $ipLong <= $this->last; $ipLong++) {
            $this->current = $ipLong;

            if ($this->isUsed($ipLong) === false) {
                return long2ip($ipLong);
            }
        }

        throw new RuntimeException('No free IP addresses left');
    }
public function next ( ) { if ( ! isset ( $ this -> current ) ) { throw new BadMethodCallException ( 'You need to call method "load()" first.' ) ; } for ( $ ipLong = $ this -> current ; $ ipLong <= $ this -> last ; $ ipLong ++ ) { $ this -> current = $ ipLong ; if ( $ this -> isUsed ( $ ipLong ) === false ) { return long2ip ( $ ipLong ) ; } } throw new RuntimeException ( 'No free IP addresses left' ) ; }
Fetches next free IP address

@return string IPv4 address

@throws Exception on error
Fetches next free IP address