You are here

function ga_push_clean_empty_array_tail in GA Push 8

Same name and namespace in other branches
  1. 7 ga_push.module \ga_push_clean_empty_array_tail()

Recursive function to delete last empty array entries.

Parameters

array $array: Array to filter.

Return value

array Filtered array.

1 call to ga_push_clean_empty_array_tail()
ga_push_method_ga_js_push in inc/ga_push.ga_js.inc
Send the ga push to JS on page load.

File

./ga_push.module, line 894
Drupal Module: GA Push.

Code

function ga_push_clean_empty_array_tail(array $array) {
  if (count($array)) {
    $last_elem = end($array);
    if ($last_elem == '') {
      array_pop($array);
      $array = ga_push_clean_empty_array_tail($array);
    }
  }
  return $array;
}