PHP Classes

Number to Word (currency): Spell Nigeria currency amounts in English

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 491 This week: 1All time: 5,871 This week: 140Up
Version License PHP version Categories
num-2-word 1.0.1GNU General Publi...3.0Text processing, Finances
Description 

Author

This package is specific mainly for applications used in Nigeria Nigeria .

This class can spell Nigeria currency amounts in English.

It can take an amount value less than 1 billion and convert it to English words that spell the amount in Naira currency.

The converted amount text is displayed as part of the current script output.

Picture of adeniyi ibraheem
  Performance   Level  
Name: adeniyi ibraheem <contact>
Classes: 6 packages by
Country: Nigeria Nigeria

Example

<?php
include 'function.php';
$con = new convert();
if(isset(
$_POST['s']))
{
   
$con->convet($_POST['a']);
}
?>
<form method="post" action="">
<input type="text" name="a" /><input type="submit" value="Convert to word" name ="s" />
</form>
<?php
/*
$d = '120.90';
$w = 0;
$num = 0;
$sd = explode(".", $d);//split
    if(strlen($sd[1]) > 2)
    {
        $sf = substr($sd[1],0, 3);
        $sa = ".".$sf;
        $w = round($sa, 2);
        $num = $sd[0] + $w;
    }
    else
    {
        $num= $sd[0].".".$sd[1];
    }
echo $num;
*/
$q = 1235;
$num2 = 0;
if(
strpos($q, ".") == TRUE)
{
$d = explode(".", $q);

    if(
$d[1] > 10)
    {
       
//add 0 to front
       
$r = round($q, 2);
       
$d1 = explode(".", $r);
        if(empty(
$d1[1]))
        {
            echo
$d1[0].".0";
        }
        else
        {
            if(
strlen($d1[1]) == 1)
            {
               
$num2 = $d1[0].".".$d1[1]."0";
            }
            else
            {
               
$num2 = $d1[0].".".$d1[1];
            }
        }
    }
    else
    {
   
//add 0 to back
       
$r = round($q, 2);
       
$d1 = explode(".", $r);
        if(empty(
$d1[1]))
        {
           
$num2 = $d1[0].".0";
        }
       
            if(
strlen($d1[1]) == 1)
            {
               
$num2 = $d1[0].".".$d1[1]."0" ;
            }
            else
            {
               
$num2 = $d1[0].".".$d1[1];
            }
    }
}
else
{
   
$num2 = $q.".00";
}
echo
$num2;
?>


  Files folder image Files  
File Role Description
Plain text file function.php Class class that perform all functions of conversion
Accessible without login Plain text file index.php Example contains textbox that accept input

 Version Control Unique User Downloads Download Rankings  
 0%
Total:491
This week:1
All time:5,871
This week:140Up