You are here

function _ajaxblocks_drupal_array_diff_assoc_recursive in Ajax Blocks 6

Copy of drupal_array_diff_assoc_recursive() from Drupal 7.

1 call to _ajaxblocks_drupal_array_diff_assoc_recursive()
ajaxblocks_ajax_handler in ./ajaxblocks.module
Handles AJAX request and returns the content of the appropriate blocks.

File

./ajaxblocks.module, line 509
Loads dynamic blocks on cached page for anonymous users by performing AJAX request.

Code

function _ajaxblocks_drupal_array_diff_assoc_recursive($array1, $array2) {
  $difference = array();
  foreach ($array1 as $key => $value) {
    if (is_array($value)) {
      if (!array_key_exists($key, $array2) || !is_array($array2[$key])) {
        $difference[$key] = $value;
      }
      else {
        $new_diff = _ajaxblocks_drupal_array_diff_assoc_recursive($value, $array2[$key]);
        if (!empty($new_diff)) {
          $difference[$key] = $new_diff;
        }
      }
    }
    elseif (!array_key_exists($key, $array2) || $array2[$key] !== $value) {
      $difference[$key] = $value;
    }
  }
  return $difference;
}