You are here

function logs_http_array_remove_empty in Logs HTTP 7

Deep array filter.

Remove empty values.

Parameters

$haystack: The variable to filter.

Return value

mixed

1 call to logs_http_array_remove_empty()
logs_http_register_event in ./logs_http.module
Register an event in a static cache.

File

./logs_http.module, line 225
Logs HTTP module.

Code

function logs_http_array_remove_empty($haystack) {
  foreach ($haystack as $key => $value) {
    if (is_array($value)) {
      $haystack[$key] = logs_http_array_remove_empty($haystack[$key]);
    }
    if (empty($haystack[$key])) {
      unset($haystack[$key]);
    }
  }
  return $haystack;
}