array_change_key_case function in php

Uncategorized 0 Comment 6

array_change_key_case() Returns an array with all keys in lowercase or uppercase

Syntax:
array_change_key_case(array,case)
array: some array values, Required
Case: 1. CASE_LOWER – Default value. Returns the array key values in lower case. , optional
2. CASE_UPPER – Returns the array key values in upper case.

Example:
$a=array(“a”=>”Cat”,”b”=>”Dog”,”c”=>”Horse”,”B”=>”Bird”);
print_r(array_change_key_case($a,CASE_UPPER));
Output:
Array ( [A] => Cat [B] => Bird [C] => Horse )

Leave a comment

You must be logged in to post a comment.

© 2016 4frienz. Powered By Flowers

Back to Top