The array_change_key_case returns an array with all keys in lowercase or uppercase. It returns an array with its keys in lowercase or uppercase. It returns FALSE if array is not an array.
Syntax
array_change_key_case(arr,case)
Parameters
arr − The array. Required.
case − Specify the case. The default is Lowercase i.e. CASE_LOWER. Optional.
Return
The array_change_key_case() function returns an array with its keys in lowercase or uppercase. It returns FALSE if array is not an array.
The following is an example to convert all keys to uppercase.
Example
<?php $vehicle = array("b"=>"Bus","t"=>"Truck"); print_r(array_change_key_case($vehicle,CASE_UPPER)); ?>
Output
Array ( [B] => Bus [T] => Truck )
The following is an example to convert all keys to lowercase.
Example
<?php $vehicle = array("C"=>"Car","T"=>"Bike"); print_r(array_change_key_case($vehicle,CASE_LOWER)); ?>
Output
Array ( [c] => Car [t] => Bike )