Change the case of the array’s keys. Set them to either all uppercase or all lowercase. This can be good for normalizing an array you’re working with. Any numeric keys are left alone and all values are always left unchanged.

The default is lowercase. Use one of two constants as the second parameter to specify the desired case: CASE_LOWER or CASE_UPPER.

$arr = array('one'   => 1,
             'Two'   => 2,
             'thREe' => 'thRee',
             4       => 'Four',
             'FIVE'  => 5);
 
$new = array_change_key_case($arr, CASE_LOWER);
/*
array (
  'one' => 1,
  'two' => 2,
  'three' => 'thRee',
  4 => 'Four',
  'five' => 5
)
*/
 
$new = array_change_key_case($arr, CASE_UPPER);
/*
array (
  'ONE' => 1,
  'TWO' => 2,
  'THREE' => 'thRee',
  4 => 'Four',
  'FIVE' => 5
)
*/
 
$new = array_change_key_case($arr); // same as CASE_LOWER
/*
array (
  'one' => 1,
  'two' => 2,
  'three' => 'thRee',
  4 => 'Four',
  'five' => 5
)
*/

Should changing the keys create a conflict, the later values will overwrite the earlier ones.

$arr = array('one'   => 1,
             'Two'   => 2,
             'thREe' => 'thRee',
             4       => 'Four',
             'FIVE'  => 5,
             'ONe'   => 6);
 
$new = array_change_key_case($arr);
/*
array (
  'one' => 6,
  'two' => 2,
  'three' => 'thRee',
  4 => 'Four',
  'five' => 5
)
*/