array_change_key_case()

array_change_key_case ($input_array , int $size [, bool $preserve_keys = FALSE ] )
ParameterDESCRIPTION
$input_arrayRequired : Input array to change key cases
$caseOptional : CASE_LOWER ( default ) , keys will be changed to lower case
CASE_UPPER , keys will be changed to upper case
Return value is an array with keys changed to Upper case or Lower case.

Example 1

$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input);
echo print_r($output);
Output is here
Array ( [one] => 1 [two] => 2 [three] => 3 [four] => 4 [five] => 5 ) 1

Example 2 with CASE_UPPER

$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input,CASE_UPPER);
echo print_r($output);
Output is here
Array ( [ONE] => 1 [TWO] => 2 [THREE] => 3 [FOUR] => 4 [FIVE] => 5 ) 1

Example 3 with CASE_LOWER ( default )

$input=array('One'=>1,'Two'=>2,'Three'=>3,'Four'=>4,'Five'=>5);
$output=array_change_key_case($input,CASE_LOWER);
echo print_r($output);
Output is here
Array ( [one] => 1 [two] => 2 [three] => 3 [four] => 4 [five] => 5 ) 1
Getting keys of an array
Array REFERENCE
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer