<?php
/**
* Description of Example
*
* @author Barida Popsana
* http://popsypedia.org/
*/
//First of all, include or require the class into your working file..
require_once "numberToWord.php";
//Now, we need a number to work with..
$number = 573021;
//Now, we create a new instance of the numberToWord class..
//The constructor takes the number to be converted as an optional parameter..
$ntw = new numberToWord( $number );
//Example 1:
//Get the converted string..
$word = $ntw->convert();
echo $word; //Prints Five hundred and seventy-three thousand and twenty one
//Example 2:
/*
If you had more than one number, you don't have to create a new instance of the numberToWord class every time as shown below:
*/
$mynumbers = array( 33000, 45201, 24095, 4496069, 8840394120 );
$ntw = new numberToWord( $number );
foreach( $mynumbers as $mn ) {
$word = $ntw->convert( $mn );
echo $word; //Echoes the converted string..
}
?>
|