function _sitealias_array_merge

8.0.x _sitealias_array_merge($site_alias_a, $site_alias_b)
6.x _sitealias_array_merge($site_alias_a, $site_alias_b)
7.x _sitealias_array_merge($site_alias_a, $site_alias_b)
5.x _sitealias_array_merge($site_alias_a, $site_alias_b)
master _sitealias_array_merge($site_alias_a, $site_alias_b)

Merges two site aliases.

array_merge_recursive is too much; we only want to run array_merge on the common top-level keys of the array.


array $site_alias_a: A site alias array.

array $site_alias_b: A site alias array.

Return value

A site alias array where the keys from $site_alias_a are overwritten by the keys from $site_alias_b.

3 calls to _sitealias_array_merge()
saUnitCase::testArrayMerge in tests/siteAliasUnitTest.php
Tests _sitealias_array_merge().
_drush_sitealias_find_and_load_alias_from_file in includes/
_drush_sitealias_find_and_load_all_aliases in includes/
Worker function called by _drush_sitealias_load_alias and drush_sitealias_load_all. Traverses the alias search path and finds the specified alias record.


includes/, line 748
The site alias API.


function _sitealias_array_merge($site_alias_a, $site_alias_b) {
  $result = $site_alias_a;

  foreach ($site_alias_b as $key => $value) {
    if (is_array($value) && array_key_exists($key, $result)) {
      $result[$key] = array_merge($result[$key], $value);
    else {
      $result[$key] = $value;

  return $result;