Zend_Config::_arrayMergeRecursive PHP Метод

_arrayMergeRecursive() защищенный Метод

Merge two arrays recursively, overwriting keys of the same name in $firstArray with the value in $secondArray.
protected _arrayMergeRecursive ( mixed $firstArray, mixed $secondArray ) : array
$firstArray mixed First array
$secondArray mixed Second array to merge into first array
Результат array
    protected function _arrayMergeRecursive($firstArray, $secondArray)
    {
        if (is_array($firstArray) && is_array($secondArray)) {
            foreach ($secondArray as $key => $value) {
                if (isset($firstArray[$key])) {
                    $firstArray[$key] = $this->_arrayMergeRecursive($firstArray[$key], $value);
                } else {
                    if ($key === 0) {
                        $firstArray = array(0 => $this->_arrayMergeRecursive($firstArray, $value));
                    } else {
                        $firstArray[$key] = $value;
                    }
                }
            }
        } else {
            $firstArray = $secondArray;
        }
        return $firstArray;
    }