integer

Snippet: function intToRoman()

A fun little function that will produce the Roman Numeral representation for any number from 1-3999.

The reason for the limitation is because the Romans used barred letters for the number 5000 and larger, and the representation of 4000 would be MV, which is hard to represent in a simple ASCII string (maybe as an exercise to the reader, the function can be extended?).

function intToRoman($number)
{
    if (!is_numeric($number)) {
        echo "Input is not a number\r\n\r\n";
        return;
    }