Home > Backend Development > PHP Tutorial > 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
Release: 2016-07-13 10:34:13
Original
1368 people have browsed it

//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...

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template