Using the static method toNumber
you can convert Roman
numerals like XLII
to Arabic numbers like
42
.
Letters prefixed with an underscore represent numbers larger than 1000.
Roman | Arabic |
---|---|
I | 1 |
V | 5 |
X | 10 |
L | 50 |
C | 100 |
D | 500 |
M | 1000 |
S, _V | 5000 |
R, _X | 10 000 |
P, _L | 50 000 |
Q, _C | 100 000 |
O, _D | 500 000 |
N, _M | 1 000 000 |
Converting Roman numerals to Arabic numbers
<?php
require_once 'Numbers/Roman.php';
echo Numbers_Roman::toNumber('XLII');
//returns: 42
?>