Created
November 9, 2013 17:52
-
-
Save Csardelacal/7387972 to your computer and use it in GitHub Desktop.
Filters an array recursively.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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