Skip to content

Instantly share code, notes, and snippets.

@Csardelacal
Created November 9, 2013 17:52
Show Gist options
  • Save Csardelacal/7387972 to your computer and use it in GitHub Desktop.
Save Csardelacal/7387972 to your computer and use it in GitHub Desktop.
Filters an array recursively.
function array_filter_recursive($element) {
if ( is_array($element) ) {
foreach ($element as &$subelement) {
$subelement = self::array_filter_recursive($subelement);
}
return array_filter($element);
}
return !!$element;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment