Home arrow PHP arrow PHP Array Functions: array_change_key_case

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.

By: TheloniusFunk
Rating: starstarstarstarstar / 0
April 16, 2012

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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));


?>


 
 
>>> More PHP Articles          >>> More By TheloniusFunk
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: