previousConverting Arabic to Roman Numerals (Previous) (Next) PEARnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Converting Roman Numerals to Arabic numbers

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.

Conversion Table: Roman letter to Arabic number
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
?>
previousConverting Arabic to Roman Numerals (Previous) (Next) PEARnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.