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 data stored in your arrays.

The array_change_key_case function allows you to manipulate the textual data in an array by transforming it into uppercase or lowercase.

Syntax:

array_change_key_case(array, CASE_LOWER or CASE_UPPER)

The array is the name of the array whose values you wish to convert to upper or lowercase.

The parameter CASE_LOWER or CASE_UPPER is used to determine whether or not you are going to convert the values in the array to upper or lower case.

Programming Samples and Usage:


<?php

$test = array ("a" => "Superman", "b" => "Batman", "c" => "Sandman");

print_r(array_change_key_case($test, CASE_LOWER));

?>


The above code takes the values in $test and converts them to lowercase.

Converting your array values to uppercase is as simple as changing the code to reflect the following:


<?php

$test = array("Superman", "Batman", "Sandman");
print_r(array_change_key_case($test, CASE_UPPER));


?>

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye