# $cart->indexOf()

> Tries to find the index number for the given element

- Source: `src/Toolkit/Iterator.php#L131` <https://github.com/getkirby/kirby/blob/6.0.0-beta.1/src/Toolkit/Iterator.php#L131>
- Inherited from Kirby, not part of the Merx API. See <https://getkirby.com/docs/reference>.

```php
$cart->indexOf( $needle): int|false
```

## Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `$needle` | `–` | `–` | the element to search for |

## Return type

`int|false`

the index (int) of the element or false

## Parent class

`Wagnerwagner\Merx\Cart` inherited from `Kirby\Toolkit\Iterator`
