> 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/includes.md).

# includes()

The includes() method tests whether an array includes a certain value among its entries

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

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

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

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

//Check array includes "Banana" from 2
$arrayUtils->includes("Banana", 2);
// expected output: false

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

{% endcode %}

## Syntax

```php
$arrayUtils->includes(mixed $needle, int $start = 0) : bool;
```

### Parameter

* `$needle`
  * The value to search for.
* `$start` <img src="https://2976351099-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKYhyHaArG9Gsnmdxc8%2F-MKk9I82AGQBHkmwnVvk%2F-MKk9YjCz_YkVR1YiRy-%2FBADGE_OPTIONAL.svg?alt=media&amp;token=3fbbac84-2f1b-40af-a991-b2eff659866a" alt="" data-size="line">&#x20;
  * &#x20;The position in this array at which to begin searching for `valueToFind`.
  * &#x20;Defaults to `0`.

### Return value

* A `boolean` the whether the element exists in the array

## Prefixing

```php
ArrayUtils::includesFrom(iterable $from, mixed $needle, int $start = 0) : bool;
```

## References

{% embed url="<https://www.php.net/manual/en/function.in-array>" %}

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes>" %}
