<?php
// by mastur
function ctword($x) {
$x = abs($x);
$number = array("", "satu", "dua", "tiga", "empat", "lima","enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
$temp = "";
if ($x <12) {
$temp = " ". $number[$x];}
else if ($x <20) {
$temp = ctword($x - 10). " belas";}
else if ($x <100) {
$temp = ctword($x/10)." puluh". ctword($x % 10);}
else if ($x <200) {
$temp = " seratus" . ctword($x - 100);}
else if ($x <1000) {
$temp = ctword($x/100) . " ratus" . ctword($x % 100);}
else if ($x <2000) {
$temp = " seribu" . ctword($x - 1000);}
else if ($x <1000000) {
$temp = ctword($x/1000) . " ribu" . ctword($x % 1000);}
else if ($x <1000000000) {
$temp = ctword($x/1000000) . " juta" . ctword($x % 1000000);}
else if ($x <1000000000000) {
$temp = ctword($x/1000000000) . " milyar" . ctword(fmod($x,1000000000));}
else if ($x <1000000000000000) {
$temp = ctword($x/1000000000000) . " trilyun" . ctword(fmod($x,1000000000000));}
return $temp;
}
// by mastur
function ctword($x) {
$x = abs($x);
$number = array("", "satu", "dua", "tiga", "empat", "lima","enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
$temp = "";
if ($x <12) {
$temp = " ". $number[$x];}
else if ($x <20) {
$temp = ctword($x - 10). " belas";}
else if ($x <100) {
$temp = ctword($x/10)." puluh". ctword($x % 10);}
else if ($x <200) {
$temp = " seratus" . ctword($x - 100);}
else if ($x <1000) {
$temp = ctword($x/100) . " ratus" . ctword($x % 100);}
else if ($x <2000) {
$temp = " seribu" . ctword($x - 1000);}
else if ($x <1000000) {
$temp = ctword($x/1000) . " ribu" . ctword($x % 1000);}
else if ($x <1000000000) {
$temp = ctword($x/1000000) . " juta" . ctword($x % 1000000);}
else if ($x <1000000000000) {
$temp = ctword($x/1000000000) . " milyar" . ctword(fmod($x,1000000000));}
else if ($x <1000000000000000) {
$temp = ctword($x/1000000000000) . " trilyun" . ctword(fmod($x,1000000000000));}
return $temp;
}