You are here

function _search_api_settings_equals in Search API 7

Test two setting arrays (or individual settings) for equality.

Parameters

mixed $setting1: The first setting (array).

mixed $setting2: The second setting (array).

Return value

bool TRUE if both settings are identical, FALSE otherwise.

Deprecated

The simple "==" operator will achieve the same.

File

./search_api.module, line 1720
Provides a flexible framework for implementing search services.

Code

function _search_api_settings_equals($setting1, $setting2) {
  if (!is_array($setting1) || !is_array($setting2)) {
    return $setting1 == $setting2;
  }
  foreach ($setting1 as $key => $value) {
    if (!array_key_exists($key, $setting2)) {
      return FALSE;
    }
    if (!_search_api_settings_equals($value, $setting2[$key])) {
      return FALSE;
    }
    unset($setting2[$key]);
  }

  // If any keys weren't unset previously, they are not present in $setting1 and
  // the two are different.
  return !$setting2;
}