public function findIndexByID($id) { $index = 0; foreach ($this as $item) { if ($item->getID() === $id) { return $index; } $index++; } return -1; }