You are here

public function ArrayCollection::indexOf 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::indexOf()

Gets the index/key of a given element. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.

Parameters

mixed $element The element to search for.:

Return value

int|string|bool The key/index of the element or FALSE if the element was not found.

Overrides Collection::indexOf

File

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

Class

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

Namespace

Doctrine\Common\Collections

Code

public function indexOf($element) {
  return array_search($element, $this->elements, true);
}