Location: PHPKode > scripts > Numeral > numeral/example.php
<?php

require_once('./class.numeral.php');

$num = new numeral(); // Numeral object.
$value = array(); // Array of values to test with.
$value[] = 2008;
$value[] = "1997";
$value[] = "MCCCXXXVII";
$value[] = 5000;
$value[] = "MCMLXXXVII";
$value[] = "1987";
$value[] = 60000;
$value[] = 500000;
$value[] = 16777216;
$value[] = "_M_M_M_M_M_M_M_M_M_M_M_M_M_M_M_M_D_C_C_L_X_X_VMMCCXVI";
// Underscore used in place of "overbar"

foreach($value as $var) { // Loop through test values using numeral
 $num->setValue($var); // object with preset value.
 echo $num->getValue()." - ";
 echo $num->getType()." - ";
 echo $num->getHindu()." - ";
 echo $num->getRoman()." - ";
 echo $num->convert()."<br />";
 echo "<br />";
}

echo "<br /><br /><br />";

$num2 = new numeral(); // Create a second numeral object.
foreach($value as $var) { // This time, loop through while setting the 
 echo $num2->getValue($var)." - "; // value as a parameter of each method.
 echo $num2->getType($var)." - "; 
 echo $num2->getHindu($var)." - "; 
 echo $num2->getRoman($var)." - ";
 echo $num2->convert($var)."<br />";
 echo "<br />";
}

?>
Return current item: Numeral