phpDoctor::_mergeArrays PHP Method

_mergeArrays() public method

Recursively merge two arrays into a single array. This differs from the PHP function array_merge_recursive as it replaces values with the same index from the first array with items from the second.
public _mergeArrays ( $one, $two ) : mixed[]
return mixed[] Merged array
    public function _mergeArrays($one, $two)
    {
        foreach ($two as $key => $item) {
            if (isset($one[$key]) && is_array($one[$key]) && is_array($item)) {
                $one[$key] = $this->_mergeArrays($one[$key], $item);
            } else {
                $one[$key] = $item;
            }
        }
        return $one;
    }