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));
?>
blog comments powered by