You are here

public function Collection::slice in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php \Doctrine\Common\Collections\Collection::slice()

Extracts a slice of $length elements starting at position $offset from the Collection.

If $length is null it returns all elements from $offset to the end of the Collection. Keys have to be preserved by this method. Calling this method will only return the selected slice and NOT change the elements contained in the collection slice is called on.

Parameters

int $offset The offset to start from.:

int|null $length The maximum number of elements to return, or null for no limit.:

Return value

array

2 methods override Collection::slice()
AbstractLazyCollection::slice in vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php
Extracts a slice of $length elements starting at position $offset from the Collection.
ArrayCollection::slice in vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php
Extracts a slice of $length elements starting at position $offset from the Collection.

File

vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php, line 262

Class

Collection
The missing (SPL) Collection/Array/OrderedMap interface.

Namespace

Doctrine\Common\Collections

Code

public function slice($offset, $length = null);