public static NestedArray::filter(array $array, callable $callable = NULL)
Filters a nested array recursively.
array $array: The filtered nested array.
callable|NULL $callable: The callable to apply for filtering.
array The filtered array.
public static function filter(array $array, callable $callable = NULL) { $array = is_callable($callable) ? array_filter($array, $callable) : array_filter($array); foreach ($array as &$element) { if (is_array($element)) { $element = static::filter($element, $callable); } } return $array; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!NestedArray.php/function/NestedArray::filter/8.1.x