function nth(int $nth, int $offset = 0) {
        if($nth <= 0) {
            throw new \InvalidArgumentException('nth must be a non-zero positive integer');
        }
        
        $new = array();
        $size = \count($this->data);
        
        for($i = $offset; $i < $size; $i += $nth) {
            $new[] = $this->data[$i];
        }
        
        return (new self($new));
    }
function nth(int $nth, int $offset = 0) {
        if($nth <= 0) {
            throw new \InvalidArgumentException('nth must be a non-zero positive integer');
        }
        
        $new = array();
        $size = \count($this->data);
        
        for($i = $offset; $i < $size; $i += $nth) {
            $new[] = $this->data[$i];
        }
        
        return (new self($new));
    }
function nth ( int $ nth , int $ offset = 0 ) { if ( $ nth <= 0 ) { throw new \ InvalidArgumentException ( 'nth must be a non-zero positive integer' ) ; } $ new = array ( ) ; $ size = \ count ( $ this -> data ) ; for ( $ i = $ offset ; $ i < $ size ; $ i += $ nth ) { $ new [ ] = $ this -> data [ $ i ] ; } return ( new self ( $ new ) ) ; }
Creates a new collection consisting of every n-th element.
@param int  $nth
@param int  $offset
@return \CharlotteDunois\Collect\Collection
@throws \InvalidArgumentException
Creates a new collection consisting of every n - th element .