PHP - Function array_change_key_case()


Advertisements


Syntax

array array_change_key_case ( array $input [, int $case] )

Definition and Usage

Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.

Parameters

Sr.No Parameter & Description
1

input

The array to work on

2

case

Either CASE_UPPER or CASE_LOWER (default)

Return Values

Returns an array with its keys lower or uppercased, or false if input is not an array.

Example

Try out following example −

<?php
   $input_array = array("FirSt"=> 1, "SecOnd" => 4);
   print_r(array_change_key_case($input_array, CASE_UPPER));
?> 

This will produce following result −

Array ( [FIRST] => 1 [SECOND] => 4 )

php_function_reference.htm

Advertisements