array_change_key_case ($input_array , int $size [, bool $preserve_keys = FALSE ] )
| Parameter | DESCRIPTION |
|---|---|
| $input_array | Required : Input array to change key cases |
| $case | Optional : CASE_LOWER ( default ) , keys will be changed to lower case CASE_UPPER , keys will be changed to upper case |
$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input);
echo print_r($output);
Output is here
Array ( [one] => 1 [two] => 2 [three] => 3 [four] => 4 [five] => 5 ) 1
$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input,CASE_UPPER);
echo print_r($output);
Output is here
Array ( [ONE] => 1 [TWO] => 2 [THREE] => 3 [FOUR] => 4 [FIVE] => 5 ) 1
$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input,CASE_LOWER);
echo print_r($output);
Output is here
Array ( [one] => 1 [two] => 2 [three] => 3 [four] => 4 [five] => 5 ) 1
Getting keys of an array
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.