public static function filter(array $arr, callable $callback)
    {
        foreach ($arr as $key => $value) {

            if (is_array($value) && count($value) > 0) {
                $arr[$key] = static::filter($value, $callback);
            }

            if (!call_user_func($callback, $arr[$key], $key)) {
                unset($arr[$key]);
            }

        }

        return $arr;
    }
public static function filter(array $arr, callable $callback)
    {
        foreach ($arr as $key => $value) {

            if (is_array($value) && count($value) > 0) {
                $arr[$key] = static::filter($value, $callback);
            }

            if (!call_user_func($callback, $arr[$key], $key)) {
                unset($arr[$key]);
            }

        }

        return $arr;
    }
public static function filter ( array $ arr , callable $ callback ) { foreach ( $ arr as $ key => $ value ) { if ( is_array ( $ value ) && count ( $ value ) > 0 ) { $ arr [ $ key ] = static :: filter ( $ value , $ callback ) ; } if ( ! call_user_func ( $ callback , $ arr [ $ key ] , $ key ) ) { unset ( $ arr [ $ key ] ) ; } } return $ arr ; }
Recursively remove elements and from an array using a callback function

@param array $arr
@param callable $callback
@return null
Recursively remove elements and from an array using a callback function