Location: PHPKode > scripts > Dec 2 Roman Converter > dec-2-roman-converter/demo.php
<html>
	<body>
<?php
include_once('Dec2RomanNumConverter.class.php');

$d2rnc = new Dec2RomanNumConverter();
$rn_array = array(); //Array that we'll be used in second example.

//Decimal 2 Roman numerals example.
try {
	for ($i = 1; $i <= 100; $i++) {
		echo $i . ' = ' . $d2rnc->dec2roman($i) . '<br />';
		$rn_array[] = $d2rnc->dec2roman($i);
	}
}
catch (Exception $ex) {
	echo $ex->getMessage();
}

//Roman 2 decimal numbers example.
$marker = 0;
foreach ($rn_array as $rn) {
	if ($marker == 0) {
		echo '<br />' . $d2rnc->roman2dec($rn);
		$marker = 1;
	}
	else {
		echo ', ' . $d2rnc->roman2dec($rn);
	}
}
?>
	</body>
</html>
Return current item: Dec 2 Roman Converter