src/Parser.php
public static function toInt(string $str) : int
    {
        $result = 0;
        $str    = mb_convert_kana(self::replaceRoman($str), 'a');
        foreach (self::$romans as $key => $value) {
            while (mb_strpos($str, $key) === 0) {
                $result += $value;
                $str = mb_substr($str, strlen($key));
            }
        }
        return $result;
    }
public static function toInt(string $str) : int
    {
        $result = 0;
        $str    = mb_convert_kana(self::replaceRoman($str), 'a');
        foreach (self::$romans as $key => $value) {
            while (mb_strpos($str, $key) === 0) {
                $result += $value;
                $str = mb_substr($str, strlen($key));
            }
        }
        return $result;
    }
public static function toInt ( string $ str ) : int { $ result = 0 ; $ str = mb_convert_kana ( self :: replaceRoman ( $ str ) , 'a' ) ; foreach ( self :: $ romans as $ key => $ value ) { while ( mb_strpos ( $ str , $ key ) === 0 ) { $ result += $ value ; $ str = mb_substr ( $ str , strlen ( $ key ) ) ; } } return $ result ; }
convert roman numerals to decimal
@param  string $str roman numerals
@return int         decimal
convert roman numerals to decimal