Menu Samaritan's Purse

ARRAY_FLIP

Exchanges all keys with their associated values in an array

SYNTAX

array_flip ( array $array ) : array

PARAMETERS

array

An array of key/value pairs to be flipped.

RETURN

Returns the flipped array on success and NULL on failure.

EXAMPLES

INDEXED

Array
(
    [a] => 0
    [b] => 1
    [c] => 2
)

ASSOCIATIVE

Array
(
    [0] => a
    [1] => b
    [2] => c
)

COLLISION

Array
(
    [0] => b
    [2] => c
)

PHP