function CollectionInterface::where
Create a new collection where the result of the given property, method, or array key of each item in the collection equals the given value.
This will always leave the original collection untouched and will return a new one.
Parameters
string | null $propertyOrMethod The property, method, or array key: to evaluate. If `null`, the element itself is compared to $value.
mixed $value The value to match.:
Return value
CollectionInterface<T>
Throws
InvalidPropertyOrMethod if the $propertyOrMethod does not exist on the elements in this collection.
UnsupportedOperationException if unable to call where() on this collection.
1 method overrides CollectionInterface::where()
- AbstractCollection::where in vendor/
ramsey/ collection/ src/ AbstractCollection.php
File
-
vendor/
ramsey/ collection/ src/ CollectionInterface.php, line 175
Class
- CollectionInterface
- A collection represents a group of values, known as its elements.
Namespace
Ramsey\CollectionCode
public function where(?string $propertyOrMethod, mixed $value) : self;