Sunday, 25 August 2013

PHP Function array_change_key_case()

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.

Paramters

ParameterDescription
inputThe array to work on
caseEither 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 )

No comments:

Post a Comment