Just a quick note. I wonder what motivated the choice to use intval() in your encode method as opposed to using round. It seem to me that roun() would return a more accurate roman value for all types of input. For example, intav(10.8)// returns 10
round(10.8)// returns 11
In the latter the roman value returned by encode() would be closer to the decimal equivalent.