Home  >  Article  >  Backend Development  >  recurse_array_change_key_case() recursively returns an array whose string key names are all lowercase or uppercase_PHP tutorial

recurse_array_change_key_case() recursively returns an array whose string key names are all lowercase or uppercase_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:34:131316browse

//Recursively returns an array whose string keys are all lowercase or uppercase
function recurse_array_change_key_case(&$input, $case = CASE_LOWER){
if(!is_array($input))
return;

foreach($input as $key => $val)
{
//1
if($case == CASE_UPPER)
{
              $newkey = strtoupper($key); );
; }
                                                                                                                in $key=>&$val
in foreach recurse_array_change_key_case($input[$newkey], $case);
}
}
}




http://www.bkjia.com/PHPjc/752221.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/752221.html

TechArticle

//Recursively returns an array whose string key names are all lowercase or uppercase function recurse_array_change_key_case($input, $case = CASE_LOWER){ if(!is_array($input)) return; foreach($input as $key...

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