public function index($subject) { $i = 0; foreach ($this->matches as $m) { if ($m === $subject) { return $i; } ++$i; } return false; }