public function ArrayCollection::remove

Removes an element with a specific key/index from the collection.

Parameters

mixed $key:

Return value

mixed The removed element or NULL, if no element exists for the given key.

Overrides Collection::remove

1 call to ArrayCollection::remove()
ArrayCollection::offsetUnset in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php
ArrayAccess implementation of offsetUnset()

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php, line 121

Class

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

Namespace

Doctrine\Common\Collections

Code

public function remove($key) {
  if (isset($this->_elements[$key])) {
    $removed = $this->_elements[$key];
    unset($this->_elements[$key]);
    return $removed;
  }
  return null;
}