src/Utilities/Arrays.php
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
public static function trimRecursive ( array $ array ) { /*
         * No elements?
         * Nothing to do
         */ if ( empty ( $ array ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ result [ $ key ] = self :: trimRecursive ( $ value ) ; continue ; } if ( is_string ( $ value ) ) { $ value = trim ( $ value ) ; } $ result [ $ key ] = $ value ; } return $ result ; }
Trims string values of given array and returns the new array

@param array $array The array which values should be trimmed
@return array
Trims string values of given array and returns the new array