PHP Array Functions: array_change_key_case

In this programming tutorial, you will learn how to use the PHP array function array_change_key_case to manipulate array keys in your arrays.

array_change_key_case() function is used to manipulate array keys(string) into UPPERCASE OR LOWERCASE.

Syntax:


array_change_key_case($array, CASE_LOWER or CASE_UPPER);

Here :
$array is the name of the array
The second parameter is manipulated type, means whether you are going to convert the values in the array to upper or lower case(default).

if you omit the second parameter, all keys are converted to lowercase, not numbers(Numbered indices are left as is).

Programming Example:

The About Code take the $name array and change all the keys into lower case.

Converting array keys to upper case is simple one like above example just change the second parameter ,here is the example :

Post By: Arjun
Website: arjunphp.com

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
DMCA.com Protection Status
0
Would love your thoughts, please comment.x
()
x