Some web applications need to display numbers in words, like e-commerce, shopping web applications, so PEAR brings a package named Numbers_Words which converts numbers to words in 2 lines of PHP code.
Checkout the example below.
Output:
More can be done with with Numbers_Words, like setting the locale so that the output is formatted according to the local, you can find Numbers_Words documentation here.
Checkout the example below.
Code: PHP
<?php
require('Numbers/Words.php');
$number = 100254;
$nw = new Numbers_Words();
$numw = $nw->toWords($number);
print $numw;
?>
Output:
Code:
one hundred thousand two hundred fifty-four

