> For the complete documentation index, see [llms.txt](https://arrayutils.docs.present.kim/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arrayutils.docs.present.kim/methods/g/index-of.md).

# indexOf()

{% code title="Example.php" %}

```php
<?php use kim\present\utils\arrays\ArrayUtils;

$arrayUtils = ArrayUtils::from(["Apple", "Banana", "Carrot"]);

//Check array includes "Banana"
$arrayUtils->indexOf("Banana");
// expected output: 1

//Check array includes "Carrot" from 2
$arrayUtils->indexOf("Banana");
// expected output: null

//Check array includes "Baccon"
$arrayUtils->indexOf("Baccon");
// expected output: null
```

{% endcode %}

## Syntax

```php
$arrayUtils->indexOf(mixed $needle, int $start = 0) : int|string|null;
```

### Parameter

* `$needle`
  * The value to search for.
* `$start` <img src="/files/-MKk9YjCz_YkVR1YiRy-" alt="" data-size="line">&#x20;

  * &#x20;The position in this array at which to begin searching for `valueToFind`.
  * &#x20;Defaults to `0`.

### Return value

* The  first index of the element in the array. If not founded, returns `NULL`.

## Prefixing

```php
ArrayUtils::indexOfFrom(iterable $from, mixed $needle, int $start = 0) : int|string|null;
```

## References

<https://www.php.net/manual/en/function.array-chunk>
