How to use array_change_key_case Function in PHP?
Now let’s see example of how to use array_change_key_case function in php.
1. Code:
<?php function changeKeyCaseOfArrAY($array){ $array = array_change_key_case($array,CASE_UPPER); return $array; } $array=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); print_r(changeKeyCaseOfArrAY($array)); ?>
2. Example:
Input:
array("Peter"=>"35","Ben"=>"37","Joe"=>"43")
Output:
Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )