The array_change_key_case() function changes all keys in an array to lowercase or uppercase.
Syntax:
array_change_key_case(array,case); array - The array to work on CASE_LOWER - Default value. Changes the keys to lowercase CASE_UPPER - Changes the keys to uppercase
This function takes array as a first parameter, It will return FALSE if given input is not an array.
Second parameter is optional,you can pass either CASE_LOWER
or CASE_UPPER
and default value is “CASE_LOWER”. This function is supported from PHP 4.2 and above.
Example :
1, "SecOnd" => 4); print_r(array_change_key_case($input_array, CASE_UPPER)); ?> // output : Array ( [FIRST] => 1 [SECOND] => 4 )
Example :
1, "SecOnd" => 4); print_r(array_change_key_case($input_array)); ?> // output : Array ( [first] => 1 [second] => 4 )