// 合并多维数组
public function my_merge(&$a, $b)
{
foreach ($a as $key => &$val) {
if (is_array($val) && array_key_exists($key, $b) && is_array($b[$key])) {
$this->my_merge($val, $b[$key]);
$val = $val + $b[$key];
} else if (is_array($val) || (array_key_exists($key, $b) && is_array($b[$key]))) {
if (isset($b[$key]) && is_array($b[$key])) {
foreach ($b[$key] as $key2 => $value2) {
$b[$key][$val] = array();
}
$val = is_array($val) ? $val : $b[$key];
}
}
}
$a = $a + $b;
return $a;
}