src/Input.php
protected static function filterArray (array $values, $filter=null, $args=array(), $doTrim=true)
    {
        if (!$values) {
            return $values;
        }

        if (!$filter) {
            $filter = self::$defaultFilter;
        }

        if (!$args) {
            $args = array ('flags' => self::$defaultFlags);
        }

        foreach ($values as $k=>$v) {
            if (is_array($v)) {
                $values[$k] = self::filterArray ($v, $filter, $args, $doTrim);
            } else {
                $values[$k] = filter_var (self::trim($v, $doTrim), $filter, $args);
            }
        }

        return $values;
    }
protected static function filterArray (array $values, $filter=null, $args=array(), $doTrim=true)
    {
        if (!$values) {
            return $values;
        }

        if (!$filter) {
            $filter = self::$defaultFilter;
        }

        if (!$args) {
            $args = array ('flags' => self::$defaultFlags);
        }

        foreach ($values as $k=>$v) {
            if (is_array($v)) {
                $values[$k] = self::filterArray ($v, $filter, $args, $doTrim);
            } else {
                $values[$k] = filter_var (self::trim($v, $doTrim), $filter, $args);
            }
        }

        return $values;
    }
protected static function filterArray ( array $ values , $ filter = null , $ args = array ( ) , $ doTrim = true ) { if ( ! $ values ) { return $ values ; } if ( ! $ filter ) { $ filter = self :: $ defaultFilter ; } if ( ! $ args ) { $ args = array ( 'flags' => self :: $ defaultFlags ) ; } foreach ( $ values as $ k => $ v ) { if ( is_array ( $ v ) ) { $ values [ $ k ] = self :: filterArray ( $ v , $ filter , $ args , $ doTrim ) ; } else { $ values [ $ k ] = filter_var ( self :: trim ( $ v , $ doTrim ) , $ filter , $ args ) ; } } return $ values ; }
Filter an array item by item. This function is recursive array safe.

@param array  $values  The array to filter
@param string $filter  The filter directive to apply to the retrieved input (optional) (default=null)
@param array  $args    The filter processing args to apply (optional) (default=array())
@param bool   $doTrim  Whether or not to apply trim() to retrieved parameter (optional) (default=true)

@return array
Filter an array item by item . This function is recursive array safe .