src/Roman.php
public static function isRoman(string $str) : bool
    {
        $str    = strtoupper(Parser::replaceRoman($str));
        $ary    = Parser::strToArray($str);
        $result = true;
        foreach ($ary as $key => $value) {
            $code = Mbstring::mb_ord($value);
            if ($code >= 97 && 122) {
                $value = strtoupper($value);
            }
            if (array_key_exists($value, self::$romans)) {
                continue;
            } else {
                $result = false;
                break;
            }
        }
        if ($result) {
            foreach (self::$romans as $key => $value) {
                while (mb_strpos($str, $key) === 0) {
                    $str = mb_substr($str, strlen($key));
                }
            }
            $result = mb_strlen($str) === 0;
        }
        return $result;
    }
public static function isRoman(string $str) : bool
    {
        $str    = strtoupper(Parser::replaceRoman($str));
        $ary    = Parser::strToArray($str);
        $result = true;
        foreach ($ary as $key => $value) {
            $code = Mbstring::mb_ord($value);
            if ($code >= 97 && 122) {
                $value = strtoupper($value);
            }
            if (array_key_exists($value, self::$romans)) {
                continue;
            } else {
                $result = false;
                break;
            }
        }
        if ($result) {
            foreach (self::$romans as $key => $value) {
                while (mb_strpos($str, $key) === 0) {
                    $str = mb_substr($str, strlen($key));
                }
            }
            $result = mb_strlen($str) === 0;
        }
        return $result;
    }
public static function isRoman ( string $ str ) : bool { $ str = strtoupper ( Parser :: replaceRoman ( $ str ) ) ; $ ary = Parser :: strToArray ( $ str ) ; $ result = true ; foreach ( $ ary as $ key => $ value ) { $ code = Mbstring :: mb_ord ( $ value ) ; if ( $ code >= 97 && 122 ) { $ value = strtoupper ( $ value ) ; } if ( array_key_exists ( $ value , self :: $ romans ) ) { continue ; } else { $ result = false ; break ; } } if ( $ result ) { foreach ( self :: $ romans as $ key => $ value ) { while ( mb_strpos ( $ str , $ key ) === 0 ) { $ str = mb_substr ( $ str , strlen ( $ key ) ) ; } } $ result = mb_strlen ( $ str ) === 0 ; } return $ result ; }
validate that string is roman numerals
@param  string $str variable being evaluated
@return bool        return true or false
validate that string is roman numerals