Menu Riverview Church

ARRAY_KEYS

Return all the keys or a subset of the keys of an array

SYNTAX

array_keys ( array $array ) : array
array_keys ( array $array , mixed $search_value [, bool $strict = FALSE ] ) : array

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

Returns an array of all the keys in array.

EXAMPLES

ARRAY | INDEXED

Array
(
    [0] => 0
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 4
)

ARRAY | ASSOCIATIVE

Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
)

SEARCH_VALUE | INDEXED

Array
(
    [0] => 2
    [1] => 4
)

SEARCH_VALUE | ASSOCIATIVE

Array
(
    [0] => c
    [1] => e
)

STRICT | INDEXED

Array
(
    [0] => 4
)

STRICT | ASSOCIATIVE

Array
(
    [0] => e
)

PHP