Arr::exists

Posted on November 16, 2016

Determine if the given key exists in the provided array.

Example usage

$car = Arr::exists(array('bmw' => 'car', 'shtil' => 'chainsaw'), 'bmw');
$nonexistent = Arr::exists(array('bmw' => 'car', 'shtil' => 'chainsaw'), 'nonexistent');

// $car = true
// $nonexistent = false

Parameters

\ArrayAccess|array $array

string|int $key

Return Value

Bool true if exist false if not.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *