PHP array_change_key_case () function

Source: Internet
Author: User

Tutorials and methods for using PHP array_change_key_case () functions.

Definitions and usage
The Array_change_key_case () function returns the key names of all arrays of an array, lowercase or uppercase.

Grammar
Array_change_key_case (Array,case)
Parameter describes the array required. Optionally, specify an array usage case. Possible value: case_lower-d Eafult value. Returns the lower critical value of the array. Case_upper-Returns the array key value uppercase. Tips and Instructions Note: If two or more array keys will be the same after this function, the last array will be replaced, etc. (see example 2) Example 1 <?php
$a =array ("a" => "Cat", "B" => "Dog", "C" => "horse");
Print_r (Array_change_key_case ($a, case_upper));
?>

Array ([A] => Cat [B] => Dog [C] => horse)

All of the array subscripts are capitalized.

Instance two.

<?php
$a =array ("a" => "Cat", "B" => "Dog", "C" => "Horse", "B" => "Bird");
Print_r (Array_change_key_case ($a, case_upper));
?>

Output results.

Array ([A] => Cat [B] => Bird [C] => horse)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.