function csl_number::roman in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_number::roman()
- 7 modules/CiteProc/CSL.inc \csl_number::roman()
1 call to csl_number::roman()
- csl_number::render in modules/
CiteProc/ CSL.inc
File
- modules/
CiteProc/ CSL.inc, line 1058
Class
Code
function roman($num) {
$ret = "";
if ($num < 6000) {
$ROMAN_NUMERALS = array(
array(
"",
"i",
"ii",
"iii",
"iv",
"v",
"vi",
"vii",
"viii",
"ix",
),
array(
"",
"x",
"xx",
"xxx",
"xl",
"l",
"lx",
"lxx",
"lxxx",
"xc",
),
array(
"",
"c",
"cc",
"ccc",
"cd",
"d",
"dc",
"dcc",
"dccc",
"cm",
),
array(
"",
"m",
"mm",
"mmm",
"mmmm",
"mmmmm",
),
);
$numstr = strrev($num);
$len = strlen($numstr);
for ($pos = 0; $pos < $len; $pos++) {
$n = $numstr[$pos];
$ret = $ROMAN_NUMERALS[$pos][$n] . $ret;
}
}
return $ret;
}