PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Barida Popsana  >  Arabic Number English Translation  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file for Number to word
Class: Arabic Number English Translation
Convert numbers to English words
Author: By
Last change:
Date: 2 years ago
Size: 1,018 bytes


Class file image Download

 * Description of Example
 * @author Barida Popsana

 //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();
$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 );
$mynumbers as $mn ) {
$word = $ntw->convert( $mn );
$word; //Echoes the converted string..