Home >php教程 >php手册 >array_change_key_case:返回字符串键名全为大写或小写的数组

array_change_key_case:返回字符串键名全为大写或小写的数组

WBOY
WBOYOriginal
2016-06-06 19:39:241068browse

array_change_key_case(array$input[,int$case=CASE_LOWER]) 将input数组中的所有键名改为全小写或大写。改变是根据后一个选项case参数来判断的 $arr1 = ['abc'='ccc','Abcd'='bbb'];$arr = array_change_key_case($arr1,CASE_UPPER);echo 'pre';print_r($ar

array_change_key_case ( array $input [, int $case = CASE_LOWER ] )
将 input 数组中的所有键名改为全小写或大写。改变是根据后一个选项 case 参数来判断的

$arr1 = ['abc'=>'ccc','Abcd'=>'bbb'];
$arr = array_change_key_case($arr1,CASE_UPPER);

echo '<pre class="brush:php;toolbar:false">';
print_r($arr);

result:
Array
(
    [ABC] => ccc
    [ABCD] => bbb
)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:百度鹰眼接口实现Next article:10000之内求素数