hasKeys

Definition

1
Arr::hasKeys(array $array, mixed $keys, bool $strict = false): bool
Copied!

Description

Check if array has specified keys ( all required, when $strict is true).

Examples

1
$array = ['key1' => 1, 'key2' => 2, 'key3' => 3];
2
3
Arr::hasKeys($array, ['key2', 'key3']) -> true
4
5
Arr::hasKeys($array, 'key1.key2') -> true
6
7
Arr::hasKeys($array, ['test', 'key1']) -> true
8
9
Arr::hasKeys($array, ['test', 'key1'], true) -> false
10
11
Arr::hasKeys($array, 'test') -> false
Copied!
Last modified 2yr ago
Copy link