# $cart->keyOf()

> Tries to find the key for the given element

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

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

## Parameters

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

## Return type

`int|string|false`

the name of the key or false

## Parent class

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