setExtractFlags(self::EXTR_BOTH); // Iterate and remove any matches $removed = false; $items = array(); $this->rewind(); while (!$this->isEmpty()) { $item = $this->extract(); if ($item['data'] === $datum) { $removed = true; continue; } $items[] = $item; } // Repopulate foreach ($items as $item) { $this->insert($item['data'], $item['priority']); } $this->setExtractFlags(self::EXTR_DATA); return $removed; } /** * Iterate the next filter in the chain * * Iterates and calls the next filter in the chain. * * @param mixed $context * @param array $params * @param FilterIterator $chain * @return mixed */ public function next($context = null, array $params = array(), $chain = null) { if (empty($context) || $chain->isEmpty()) { return; } $next = $this->extract(); if (!$next instanceof CallbackHandler) { return; } $return = call_user_func($next->getCallback(), $context, $params, $chain); return $return; } }