public static function decodeWithChecksum($string, $errmode = self::NORMALIZE_ERRMODE_SILENT)
    {
        $checksum = substr($string, (strlen($string) -1), 1);
        $string = substr($string, 0, strlen($string) - 1);

        $value = static::internalDecode($string, $errmode);
        $checksumValue = static::internalDecode($checksum, self::NORMALIZE_ERRMODE_EXCEPTION, true);

        if ($checksumValue !== ($value % 37)) {
            throw new \RuntimeException("Checksum symbol '$checksum' is not correct value for '$string'");
        }

        return $value;
    }
public static function decodeWithChecksum($string, $errmode = self::NORMALIZE_ERRMODE_SILENT)
    {
        $checksum = substr($string, (strlen($string) -1), 1);
        $string = substr($string, 0, strlen($string) - 1);

        $value = static::internalDecode($string, $errmode);
        $checksumValue = static::internalDecode($checksum, self::NORMALIZE_ERRMODE_EXCEPTION, true);

        if ($checksumValue !== ($value % 37)) {
            throw new \RuntimeException("Checksum symbol '$checksum' is not correct value for '$string'");
        }

        return $value;
    }
public static function decodeWithChecksum ( $ string , $ errmode = self :: NORMALIZE_ERRMODE_SILENT ) { $ checksum = substr ( $ string , ( strlen ( $ string ) - 1 ) , 1 ) ; $ string = substr ( $ string , 0 , strlen ( $ string ) - 1 ) ; $ value = static :: internalDecode ( $ string , $ errmode ) ; $ checksumValue = static :: internalDecode ( $ checksum , self :: NORMALIZE_ERRMODE_EXCEPTION , true ) ; if ( $ checksumValue !== ( $ value % 37 ) ) { throw new \ RuntimeException ( "Checksum symbol '$checksum' is not correct value for '$string'" ) ; } return $ value ; }
Decode a string with checksum

@param string $string  Encoded string
@param int    $errmode Error mode

@return int

@throws \RuntimeException
Decode a string with checksum