PHP Classes

File: cwordstonumbers/tests/simpleConversion.php

Recommend this page to a friend!
  Classes of Mohammed Asad  >  PHP Convert Words to Numbers  >  cwordstonumbers/tests/simpleConversion.php  >  Download  
File: cwordstonumbers/tests/simpleConversion.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Convert Words to Numbers
Convert text with an amount to its numeric value
Author: By
Last change:
Date: 5 years ago
Size: 1,313 bytes
 

Contents

Class file image Download
<?php
   
/**
    * A simple example to use this class
    * All you need to do is to include the class and use it right away as given below
    * In other terms, just do ctrl+c and ctrl+v.
    */
require '../src/cWordsToNumbers.class.php';

   
$objWordsToNumbers = new cWordsToNumbers();
$objWordsToNumbers->setEnableNumberFormatting( true );

echo
$objWordsToNumbers->displayNumbers( "nine" ) . "<br/>";
echo
$objWordsToNumbers->displayNumbers( "ninty nine" ) . "<br/>";
echo
$objWordsToNumbers->displayNumbers( "nine hundred and ninty nine" ) . "<br/>";
echo
$objWordsToNumbers->displayNumbers( "nine thousand nine hundred and ninty nine" ) . "<br/>";
echo
$objWordsToNumbers->displayNumbers( "ninty thousand nine hundred and ninty nine" ) . "<br/>";
echo
"<h2>Indian Number system</h2>";

echo
$objWordsToNumbers->displayNumbers( "nine lakh nine thousand nine hundred and ninty nine" ) . "<br/>";

echo
$objWordsToNumbers->displayNumbers( "nine crore nine thousand nine hundred and ninty nine" ) . "<br/>";

echo
"<h2>Western Number system</h2>";

echo
$objWordsToNumbers->displayNumbers( "nine hundred and ninty nine thousand nine hundred and ninty nine" ) . "<br/>";

echo
$objWordsToNumbers->displayNumbers( "nine million nine hundred and ninty nine thousand nine hundred and ninty nine" ) . "<br/>";
?>

For more information send a message to info at phpclasses dot org.