public static function romanToInt($str = null)
    {
        if (is_null($str)) {
            return null;
        }
        if ($str==self::$romans_letters[0]) {
            return 0;
        }
        if (!self::isRomanNumber($str)) {
            return false;
        }
        $result = 0;
        $length = strlen($str);
        for ($i=0; $i < $length; $i++) {
            $index      = array_search($str{$i}, self::$romans_letters);
            $value      = self::$romans_numbers[$index];
            $nextval    = null;
            if ($i < ($length - 1)) {
                $nextind    = array_search($str{$i + 1}, self::$romans_letters);
                $nextval    = self::$romans_numbers[$nextind];
            }
            $result     += (!is_null($nextval) && $nextval > $value) ? -$value : $value;
        }
        return $result;
    }