src/ORM/ArrayList.php
public function limit($length, $offset = 0)
    {
        // Type checking: designed for consistency with DataList::limit()
        if (!is_numeric($length) || !is_numeric($offset)) {
            Deprecation::notice(
                '4.3',
                'Arguments to ArrayList::limit() should be numeric'
            );
        }

        if ($length < 0 || $offset < 0) {
            Deprecation::notice(
                '4.3',
                'Arguments to ArrayList::limit() should be positive'
            );
        }

        if (!$length) {
            if ($length === 0) {
                Deprecation::notice(
                    '4.3',
                    "limit(0) is deprecated in SS4. In SS5 a limit of 0 will instead return no records."
                );
            }

            $length = count($this->items);
        }

        $list = clone $this;
        $list->items = array_slice($this->items, $offset, $length);

        return $list;
    }
public function limit($length, $offset = 0)
    {
        // Type checking: designed for consistency with DataList::limit()
        if (!is_numeric($length) || !is_numeric($offset)) {
            Deprecation::notice(
                '4.3',
                'Arguments to ArrayList::limit() should be numeric'
            );
        }

        if ($length < 0 || $offset < 0) {
            Deprecation::notice(
                '4.3',
                'Arguments to ArrayList::limit() should be positive'
            );
        }

        if (!$length) {
            if ($length === 0) {
                Deprecation::notice(
                    '4.3',
                    "limit(0) is deprecated in SS4. In SS5 a limit of 0 will instead return no records."
                );
            }

            $length = count($this->items);
        }

        $list = clone $this;
        $list->items = array_slice($this->items, $offset, $length);

        return $list;
    }
public function limit ( $ length , $ offset = 0 ) { // Type checking: designed for consistency with DataList::limit() if ( ! is_numeric ( $ length ) || ! is_numeric ( $ offset ) ) { Deprecation :: notice ( '4.3' , 'Arguments to ArrayList::limit() should be numeric' ) ; } if ( $ length < 0 || $ offset < 0 ) { Deprecation :: notice ( '4.3' , 'Arguments to ArrayList::limit() should be positive' ) ; } if ( ! $ length ) { if ( $ length === 0 ) { Deprecation :: notice ( '4.3' , "limit(0) is deprecated in SS4. In SS5 a limit of 0 will instead return no records." ) ; } $ length = count ( $ this -> items ) ; } $ list = clone $ this ; $ list -> items = array_slice ( $ this -> items , $ offset , $ length ) ; return $ list ; }
Get a sub-range of this dataobjectset as an array

@param int $length
@param int $offset
@return static
Get a sub - range of this dataobjectset as an array