PHP: array_change_ key_case() function

January 5, 2019

In this, Tutorial We are Learning How to convert array values to lowearcase or How to Convert array values in Uppercase using array_change_ key_case() function in PHP.

The array_change_ key_case() function is used to Change all array keys to lower case or upper case. This is Avaible in Php 4 version and Above Version.

The array_change_ key_case() function returns an array with all keys in lowercase or uppercase.

array_change_ key_case() with Uppercase

The Following is an Example to convert all keys to uppercase

Input Code

Output

array_change_ key_case() with Lowercase

The Following is an Example to convert all keys to Lowercase

Input Code

Output

This is the Use and Syntax of array_change_ key_case() function

Note:

If Two or more keys will be equal after running array_change_key_case() (e.g. “a” and “A”), the latest array will override the other:

Input Code

Output

There are two Same key after using the array_change_key_case() then last value is override the Other Values.

For More Detail about this Function You have to Read this PHP Function.

Hope this Helps.

Leave a Reply

Your email address will not be published. Required fields are marked *