src/Html2Pdf.php
protected function _listeArab2Rom($nbArabic)
    {
        $nbBaseTen  = array('I','X','C','M');
        $nbBaseFive = array('V','L','D');
        $nbRoman    = '';

        if ($nbArabic<1) {
            return $nbArabic;
        }
        if ($nbArabic>3999) {
            return $nbArabic;
        }

        for ($i=3; $i>=0; $i--) {
            $digit=floor($nbArabic/pow(10, $i));
            if ($digit>=1) {
                $nbArabic -= $digit*pow(10, $i);
                if ($digit<=3) {
                    for ($j=$digit; $j>=1; $j--) {
                        $nbRoman .= $nbBaseTen[$i];
                    }
                } elseif ($digit == 9) {
                    $nbRoman .= $nbBaseTen[$i].$nbBaseTen[$i+1];
                } elseif ($digit == 4) {
                    $nbRoman .= $nbBaseTen[$i].$nbBaseFive[$i];
                } else {
                    $nbRoman .= $nbBaseFive[$i];
                    for ($j=$digit-5; $j>=1; $j--) {
                        $nbRoman .= $nbBaseTen[$i];
                    }
                }
            }
        }
        return $nbRoman;
    }
protected function _listeArab2Rom($nbArabic)
    {
        $nbBaseTen  = array('I','X','C','M');
        $nbBaseFive = array('V','L','D');
        $nbRoman    = '';

        if ($nbArabic<1) {
            return $nbArabic;
        }
        if ($nbArabic>3999) {
            return $nbArabic;
        }

        for ($i=3; $i>=0; $i--) {
            $digit=floor($nbArabic/pow(10, $i));
            if ($digit>=1) {
                $nbArabic -= $digit*pow(10, $i);
                if ($digit<=3) {
                    for ($j=$digit; $j>=1; $j--) {
                        $nbRoman .= $nbBaseTen[$i];
                    }
                } elseif ($digit == 9) {
                    $nbRoman .= $nbBaseTen[$i].$nbBaseTen[$i+1];
                } elseif ($digit == 4) {
                    $nbRoman .= $nbBaseTen[$i].$nbBaseFive[$i];
                } else {
                    $nbRoman .= $nbBaseFive[$i];
                    for ($j=$digit-5; $j>=1; $j--) {
                        $nbRoman .= $nbBaseTen[$i];
                    }
                }
            }
        }
        return $nbRoman;
    }
protected function _listeArab2Rom ( $ nbArabic ) { $ nbBaseTen = array ( 'I' , 'X' , 'C' , 'M' ) ; $ nbBaseFive = array ( 'V' , 'L' , 'D' ) ; $ nbRoman = '' ; if ( $ nbArabic < 1 ) { return $ nbArabic ; } if ( $ nbArabic > 3999 ) { return $ nbArabic ; } for ( $ i = 3 ; $ i >= 0 ; $ i -- ) { $ digit = floor ( $ nbArabic / pow ( 10 , $ i ) ) ; if ( $ digit >= 1 ) { $ nbArabic -= $ digit * pow ( 10 , $ i ) ; if ( $ digit <= 3 ) { for ( $ j = $ digit ; $ j >= 1 ; $ j -- ) { $ nbRoman .= $ nbBaseTen [ $ i ] ; } } elseif ( $ digit == 9 ) { $ nbRoman .= $ nbBaseTen [ $ i ] . $ nbBaseTen [ $ i + 1 ] ; } elseif ( $ digit == 4 ) { $ nbRoman .= $ nbBaseTen [ $ i ] . $ nbBaseFive [ $ i ] ; } else { $ nbRoman .= $ nbBaseFive [ $ i ] ; for ( $ j = $ digit - 5 ; $ j >= 1 ; $ j -- ) { $ nbRoman .= $ nbBaseTen [ $ i ] ; } } } } return $ nbRoman ; }
Convert an arabic number into a roman number

@access protected
@param  integer $nbArabic
@return string  $nbRoman
Convert an arabic number into a roman number