PHP Class Wikimedia\Composer\Merge\NestedArray

Show file Open project: wikimedia/composer-merge-plugin Class Usage Examples

Public Methods

Method Description
mergeDeep ( ) : array Merges multiple arrays, recursively, and returns the merged array.
mergeDeepArray ( array $arrays, boolean $preserveIntegerKeys = false ) : array Merges multiple arrays, recursively, and returns the merged array.

Method Details

mergeDeep() public static method

This function is similar to PHP's array_merge_recursive() function, but it handles non-array values differently. When merging values that are not both arrays, the latter value replaces the former rather than merging with it. Example:
See also: NestedArray::mergeDeepArray()
public static mergeDeep ( ) : array
return array The merged array.

mergeDeepArray() public static method

This function is equivalent to NestedArray::mergeDeep(), except the input arrays are passed as a single array parameter rather than a variable parameter list. The following are equivalent: - NestedArray::mergeDeep($a, $b); - NestedArray::mergeDeepArray(array($a, $b)); The following are also equivalent: - call_user_func_array('NestedArray::mergeDeep', $arrays_to_merge); - NestedArray::mergeDeepArray($arrays_to_merge);
See also: NestedArray::mergeDeep()
public static mergeDeepArray ( array $arrays, boolean $preserveIntegerKeys = false ) : array
$arrays array An arrays of arrays to merge.
$preserveIntegerKeys boolean (optional) If given, integer keys will be preserved and merged instead of appended. Defaults to false.
return array The merged array.