$new_array = array();
foreach($old_array AS $k => $v){
if( array_key_exists($k, $new_array) ){
$new_array[$k] = $new_array[$k] + $v;
}else{
$new_array[$k] = $v;
}
}
ksort($new_array); // 依照Key值排序
$new_array = array();
foreach($old_array AS $k => $v){
if( array_key_exists($k, $new_array) ){
$new_array[$k] = $new_array[$k] + $v;
}else{
$new_array[$k] = $v;
}
}
ksort($new_array); // 依照Key值排序