Skip to content
master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Nov 10, 2014
Nov 10, 2014
Nov 10, 2014

README.md

Terbilang

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Convert numbers into words in Indonesian language.

Installation

Run composer command

composer require nasution/terbilang

Usage

Use terbilang() helper

<?php

require 'vendor/autoload.php';

echo terbilang(421);                  // empat ratus dua puluh satu

Old examples

<?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 examples

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
You can’t perform that action at this time.