PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

array_keys

Tags: PHP 5.x PHP 7.x PHP 8.x

array_keys — Return all the keys or a subset of the keys of an array.

Description

array_keys(
    array $array,
): array

Description

array_keys(
    array $array,
mixed $search_value,
bool $strict = false
): array
array_keys() returns the keys, numeric and string, from the array.
If a search_value is specified, then only the keys for that value are returned. Otherwise, all the keys from the array are returned.

Parameters

Parameters

array
An array containing keys to return.
search_value
If specified, then only keys containing these values are returned.
strict
Determines if strict comparison (===) should be used during the search.

Return Values

Returns an array of all the keys in array.

array_keys - New snippets