lithium\util\Set::append()

public static method

Add the keys/values in $array2 that are not found in $array onto the end of $array.

Parameters

  • mixed $array

    Original array.

  • mixed $array2

    Second array to add onto the original.

Returns

array

An array containing all the keys of the second array not already present in the first.

Source

	public static function append(array $array, array $array2) {
		$arrays = func_get_args();
		$array = array_shift($arrays);
		foreach ($arrays as $array2) {
			if (!$array && $array2) {
				$array = $array2;
				continue;
			}
			foreach ($array2 as $key => $value) {
				if (!array_key_exists($key, $array)) {
					$array[$key] = $value;
				} elseif (is_array($value)) {
					$array[$key] = static::append($array[$key], $array2[$key]);
				}
			}
		}
		return $array;
	}