PHP array_change_key_case() functionIt is an inbuilt function of PHP. The array_change_key_case() function returns an array with all arrays keys in lower case or upper case. Syntax
Important Note: If the second parameter is avoided then by default the keys of array will get converted to lowercase.Example 1Output: Array( [A]=>a [E]=>e [I]=>i [O]=>o [U]=>u ) Example 2Output: Array ( [rahul]=> 10000 [ajay]=> 15000 [sid]=> 20000 ) Example 3If two or more array keys will be the same after running array_change_key_case( ) function, the latest array will override the other. Output: Array ([A]=> Agra [B]=> Bengaluru [C]=> Chennai ) Example 4If we ignore the second parameter in the function array_change_key_case( ) then the keys will be converted to lowercase. Output: Array ([rahul]=> 10 [vikas]=> 20 [sid]=> 25 )
Next TopicPHP Array Functions
|