array_change_key_case

PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
array_change_key_case - Changes the case of all keys in an array

array_change_key_case( array$array, [int$case = CASE_LOWER] ): array

Returns an array with all keys from array lowercased or uppercased. Numbered indices are left as is.

Parameters

array

The array to work on

case

Either CASE_UPPER or CASE_LOWER (default)

Return Values

Returns an array with its keys lower or uppercased, or null if array is not an array.

Exceptions and Errors

Throws E_WARNING if array is not an array.

Notes

Note:

If an array has indices that will be the same once run through this function (e.g. "keY" and "kEY"), the value that is later in the array will override other indices.

Example of array_change_key_case

Show all examples for array_change_key_case

PHP Version:


Function array_change_key_case:

Arrays Functions

Most used PHP functions