protected static function arrayMergeRecursive($array1, $array2)
	{
		if ( !is_array($array1) || !is_array($array2) ) {
			return $array2;
		}

		foreach ( $array2 as $array2_key => $array2_value ) {
			if ( isset($array1[$array2_key]) ) {
				$array1[$array2_key] = self::arrayMergeRecursive($array1[$array2_key], $array2_value);
			}
			else {
				$array1[$array2_key] = $array2_value;
			}
		}

		return $array1;
	}
protected static function arrayMergeRecursive($array1, $array2)
	{
		if ( !is_array($array1) || !is_array($array2) ) {
			return $array2;
		}

		foreach ( $array2 as $array2_key => $array2_value ) {
			if ( isset($array1[$array2_key]) ) {
				$array1[$array2_key] = self::arrayMergeRecursive($array1[$array2_key], $array2_value);
			}
			else {
				$array1[$array2_key] = $array2_value;
			}
		}

		return $array1;
	}
protected static function arrayMergeRecursive ( $ array1 , $ array2 ) { if ( ! is_array ( $ array1 ) || ! is_array ( $ array2 ) ) { return $ array2 ; } foreach ( $ array2 as $ array2_key => $ array2_value ) { if ( isset ( $ array1 [ $ array2_key ] ) ) { $ array1 [ $ array2_key ] = self :: arrayMergeRecursive ( $ array1 [ $ array2_key ] , $ array2_value ) ; } else { $ array1 [ $ array2_key ] = $ array2_value ; } } return $ array1 ; }
Similar to array_merge_recursive but keyed-valued are always overwritten.

Priority goes to the 2nd array.

@param mixed $array1 First array.
@param mixed $array2 Second array.

@return array
Similar to array_merge_recursive but keyed - valued are always overwritten .