79502107

Date: 2025-03-11 21:04:05
Score: 1
Natty:
Report link


function intToRomanianOrReverse($value, bool $array = true) {
    static $nfh = new \NumberFormatter('@numbers=roman', \NumberFormatter::DECIMAL);

    return $nfh->{$array ? 'format' : 'parse'}($value);
}

function intToRomanNumeral(int $value): ?string {
    return intToRomanianOrReverse($value, true);
}

function romanNumeralToInt(string $roman): ?int {
    return intToRomanianOrReverse($value, false);
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Alexey Shatrov