You are here

function apachesolr_array_merge_deep_array in Apache Solr Search 6.3

Backport of http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupa...

Parameters

type $arrays:

Return value

array

1 call to apachesolr_array_merge_deep_array()
apachesolr_load_all_environments in ./apachesolr.module
Function that loads all the environments

File

./apachesolr.module, line 1264
Integration with the Apache Solr search application.

Code

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

      // Renumber integer keys as array_merge_recursive() does. Note that PHP
      // automatically converts array keys that are integer strings (e.g., '1')
      // to integers.
      if (is_integer($key)) {
        $result[] = $value;
      }
      elseif (isset($result[$key]) && is_array($result[$key]) && is_array($value)) {
        $result[$key] = apachesolr_array_merge_deep_array(array(
          $result[$key],
          $value,
        ));
      }
      else {
        $result[$key] = $value;
      }
    }
  }
  return $result;
}