You are here

public function ArrayCollection::filter in Zircon Profile 8

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

Returns all the elements of this collection that satisfy the predicate p. The order of the elements is preserved.

Parameters

Closure $p The predicate used for filtering.:

Return value

Collection A collection with the results of the filter operation.

Overrides Collection::filter

File

vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php, line 293

Class

ArrayCollection
An ArrayCollection is a Collection implementation that wraps a regular PHP array.

Namespace

Doctrine\Common\Collections

Code

public function filter(Closure $p) {
  return new static(array_filter($this->elements, $p));
}