You are here

function i18n_string_array_merge in Internationalization 7

Merges multiple arrays, recursively, and returns the merged array.

This function is not equivalent to PHP's array_merge_recursive(), as this version leaves integer keys intact.

Parameters

...: Arrays to merge.

Return value

The merged array.

See also

drupal_array_merge_deep(), @see array_merge_recursive()

3 calls to i18n_string_array_merge()
i18n_string_i18n_string_list in i18n_string/i18n_string.i18n.inc
Implements hook_i18n_string_list().
i18n_string_module_string_list in i18n_string/i18n_string.admin.inc
Get all strings from a module.
i18n_string_object_type_string_list in i18n_string/i18n_string.i18n.inc
Get object string list that are in this text group.

File

i18n_string/i18n_string.i18n.inc, line 87
Implementation of i18n hooks

Code

function i18n_string_array_merge() {
  $arrays = func_get_args();
  $result = array();
  foreach ($arrays as $array) {
    foreach ($array as $key => $value) {

      // Recurse when both values are arrays.
      if (isset($result[$key]) && is_array($result[$key]) && is_array($value)) {
        $result[$key] = i18n_string_array_merge($result[$key], $value);
      }
      else {
        $result[$key] = $value;
      }
    }
  }
  return $result;
}