Numbers_Roman
[ class tree: Numbers_Roman ] [ index: Numbers_Roman ] [ all elements ]

Source for file example.php

Documentation is available at example.php

  1. <?php
  2. // Numbers Roman example
  3.  
  4. require_once("Numbers/Roman.php");
  5. $Num rand(1,3999)
  6. $NumHtml rand(500,5999999);
  7.  
  8. //converting a random number between 1 and 3999 from Arabic to the Roman Numeral
  9. //uppercase true, html false, then back to Arabic
  10. $key =  Numbers_Roman::toNumeral($Num,true,false);
  11. $NumKey Numbers_Roman::toNumber($key);
  12.  
  13.  
  14. // converting a random number between 500 and 5 999 999 to the Roman Numeral
  15. $RomeHtml     =  Numbers_Roman::toNumeral($NumHtml,true,true);       //uppercase true html true
  16. $RomenoHtml   =  Numbers_Roman::toNumeral($NumHtml,true,false);    //uppercase true html false
  17. $RomeHtmlnoLC =  Numbers_Roman::toNumeral($NumHtml,false,true);  //uppercase false html true
  18. $RomenoHtmlLC =  Numbers_Roman::toNumeral($NumHtml,false,false);  //uppercase false html false
  19.  
  20. $toArabic Numbers_Roman::toNumber($RomenoHtml)//back to the Arabic number 
  21.  
  22. echo "Random: ".$Num." (To roman) -> ".$key." (Back to arabic) -> ".$NumKey." <BR> <BR>";
  23.  
  24. echo "Random with HTML enabled converting ".$NumHtml." into a Roman Numeral ".$RomeHtml."<BR>";
  25. echo "Lowercase html $RomeHtmlnoLC.. <BR> ".$RomenoHtml." uppercase no html <BR> 
  26. $RomenoHtmlLC lowercase no html <BR>and back to Arabic ".$toArabic."";
  27. ?>

Documentation generated on Mon, 11 Mar 2019 15:10:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.