PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Nikola Posa   Dec2RomanNumConverter   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Demo script.
Class: Dec2RomanNumConverter
Convert numbers between decimal and roman
Author: By
Last change: New demo
Date: 13 years ago
Size: 1,550 bytes
 

Contents

Class file image Download
<?php
/**
 * Dec2RomanNumConverter
 *
 * Copyright (C) 2009 Nikola Posa (http://www.nikolaposa.in.rs)
 *
 * This file is part of Dec2RomanNumConverter.
 *
 * Dec2RomanNumConverter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Dec2RomanNumConverter is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Dec2RomanNumConverter. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Demo script.
 *
 * @author Nikola Posa, www.nikolaposa.in.rs
 * @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License
 */
?>

<html>
    <body>
<?php
require_once 'libs/Dec2RomanNumConverter.php';

$rnArray = array();

//Decimal 2 Roman numerals conversion example.
for ($i = 1; $i <= 100; $i++) {
   
$romanNumeral = Dec2RomanNumConverter::dec2roman($i);
    echo
$i . ' => ' . $romanNumeral . '<br />';
   
$rnArray[] = $romanNumeral;
}

echo
'
    <br />
    '
;

//Roman 2 decimal numbers conversion example.
foreach ($rnArray as $rn) {
    echo
$rn . ' => ' . Dec2RomanNumConverter::roman2dec($rn) . '<br />';
}
?>
</body>
</html>