array_change_key_case
array_change_key_case
Changes the case of all keys in an array
array **array_change_key_case** array $array int $case
Returns an array with all keys from lowercased
or uppercased. Numbered indices are left as is.
array
arrayThe array to work on
case
Either or
(default)
CASE_UPPER``CASE_LOWER
Returns an array with its keys lower or uppercased.
Voorbeeld: example
<?php
$input_array = array("FirSt" => 1, "SecOnd" => 4);
print_r(array_change_key_case($input_array, CASE_UPPER));
?>
Array
(
[FIRST] => 1
[SECOND] => 4
)
Opmerking: > If an array has indices that will be the same once run through this function (e.g. "" and ""), the value that is later in the array will override other indices.
keY``kEY