标签:ret turn return int change blog log var echo
$arr = [ ‘a‘ => ‘A‘, ‘b‘ => ‘B‘, ‘c‘ => [ ‘d‘=> ‘D‘, ‘e‘=>[ ‘f‘=>‘F‘, ‘g‘=>[‘h‘=>‘H‘] ] ] ]; //创建一个数组处理函数 function changeCase($var,$type = CASE_UPPER){ $var = array_change_key_case($var,$type); foreach($var as $key => $value){ if(is_array($value)){ $var[$key]=changeCase($value); } } return $var; } $res = changeCase($arr); pre($res); function pre($var){ echo ‘<pre>‘; print_r($var); echo ‘</pre>‘; }
递归这个数组 把键名 全部换成大写的
标签:ret turn return int change blog log var echo
原文地址:http://www.cnblogs.com/as3lib/p/6067816.html