Home Menu

array_change_key_case

Changes the case of all keys in an array

Syntax

array_change_key_case ( array $array [, int $case = CASE_LOWER ] ) : array

Parameters

array

The array to work on

case

Either CASE_UPPER or CASE_LOWER (default)

Return

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

Examples

array

<?

$array = array("zErO" => 0, "oNe" => 1);

$return = array_change_key_case($array);

print_r($return);

?>
Array
(
    [zero] => 0
    [one] => 1
)

case

<?

$array = array("zErO" => 0, "oNe" => 1);
$case = CASE_UPPER;

$return = array_change_key_case($array, $case);

print_r($return);

?>
Array
(
    [ZERO] => 0
    [ONE] => 1
)

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms