public static function unformat($value)
    {
        if (is_array($value)) {
            foreach ($value as &$val) {
                $val = self::unformat($val);
            }
            return $value;
        }

        if (!$value) {
            $value = 0;
        }

        $neg = false;
        if (strpos($value, '-') === 0) {
            $neg = true;
        }

        $cleanString = preg_replace('/([^0-9\.,])/i', '', $value);
        $onlyNumbersString = preg_replace('/([^0-9])/i', '', $value);

        $separatorsCountToBeErased = strlen($cleanString) - strlen($onlyNumbersString)
            - 1;

        $stringWithCommaOrDot = preg_replace(
            '/([,\.])/',
            '',
            $cleanString,
            $separatorsCountToBeErased
        );
        $removedThousendSeparator = preg_replace(
            '/(\.|,)(?=[0-9]{3,}$)/',
            '',
            $stringWithCommaOrDot
        );

        $value = str_replace(',', '.', $removedThousendSeparator);
        if ($neg) {
            $value = -1 * abs($value);
        }
        return $value;
    }