Convert numbers into words in Indonesian language.
Download composer.phar if you don't have one. Then run it from terminal.
php composer.phar require "nasution/terbilang: *"
Or, you can put into your composer.json
file.
"require": {
"nasution/terbilang": "*"
}
Then run composer update
php composer.phar update
<?php
require 'vendor/autoload.php';
$terbilang = new Nasution\Terbilang();
echo $terbilang->convert(234); // dua ratus tiga puluh empat
// OR with static method
echo Nasution\Terbilang::convert(42); // empat puluh dua
You can import that class to make it more simple to called
<?php
require 'vendor/autoload.php';
use Nasution\Terbilang;
$terbilang = new Terbilang();
echo $terbilang->convert(2014); // dua ribu empat belas
// OR with static method
echo Terbilang::convert('123304'); // seratus dua puluh tiga ribu tiga ratus empat
Another example
echo Terbilang::convert('1000000'); // satu juta
echo Terbilang::convert('1000000000'); // satu milyar
echo Terbilang::convert('1000000000000'); // satu triliun
echo Terbilang::convert('1000000000000000'); // satu kuadriliun
You can also use dot notation to separate the numbers
echo Terbilang::convert('1.300.000'); // satu juta tiga ratus ribu
echo Terbilang::convert('100.030.020.010'); // seratus milyar tiga puluh juta dua puluh ribu sepuluh