joaoreisweb/numbers-in-roman

This library convert numbers into roman numerals.

v1.0 2021-07-20 10:13 UTC

This package is auto-updated.

Last update: 2024-10-22 18:02:39 UTC


README

This library convert numbers into roman numerals.

INSTALL with composer

composer require joaoreisweb/numbers-in-roman

USAGE

<?php

require_once realpath("vendor/autoload.php");

use joaoreisweb\NumbersInRoman;

$number_convert = new NumbersInRoman();

$number = 1500;
echo '<br>'.$number.' - '.$number_convert->convertIntToRoman($number);

$number = 1600;
echo '<br>'.$number.' - '.$number_convert->convertIntToRoman($number);

$number = 1000;
echo '<br>'.$number.' - '.$number_convert->convertIntToRoman($number);

$number = 1550;
echo '<br>'.$number.' - '.$number_convert->convertIntToRoman($number);

$roman = 'MMXXI';
echo '<br>'.$roman.' - '.$number_convert->convertRomanToInt($roman);

$roman = 'MCDDXIV';
echo '<br>'.$roman.' - '.$number_convert->convertRomanToInt($roman);

RESULTS

1500 - MD
1600 - MDC
1000 - M
1550 - MDL
MMXXI - 2021
MCDDXIV - 1914