PHP Classes

Convert from Roman to Arabic bug

Recommend this page to a friend!

      Roman Numeral Conversion  >  All threads  >  Convert from Roman to Arabic bug  >  (Un) Subscribe thread alerts  
Subject:Convert from Roman to Arabic bug
Summary:Convert from Roman to Arabic bug
Messages:2
Author:Jaroslav
Date:2012-09-18 08:27:15
Update:2012-09-18 09:22:40
 

 


  1. Convert from Roman to Arabic bug   Reply   Report abuse  
Picture of Jaroslav Jaroslav - 2012-09-18 08:27:15
Hi,
example code

$converter = new ConvertRoman("MMDCCXXVII");
echo $converter->result().'<br>';

returns

MMDCCXXVII2727

Aha, I have to delete the command "print..." in the class.
Good joke ;)

  2. Re: Convert from Roman to Arabic bug   Reply   Report abuse  
Picture of Jaroslav Jaroslav - 2012-09-18 09:22:40 - In reply to message 1 from Jaroslav
$number = 8000;
$converter = new ConvertRoman($number);
$rom = $converter->result();
echo $converter->result().'===&gt;';
$converter = new ConvertRoman($rom);
echo $converter->result().'<br>';

returns right values by your class rules

_VMMM===>8000 , right roman value by convention is VIIIM or VIII.M


$number = 4000;
$converter = new ConvertRoman($number);
$rom = $converter->result();
echo $converter->result().'===&gt;';
$converter = new ConvertRoman($rom);
echo $converter->result().'<br>';

returns bad arabic value

M_V===>6000 , right roman value by convention is IVM or IV.M