helpers.php
Table of Contents
Functions
- hargaTerbilang() : string
- Converts a number to its Indonesian word representation for currency.
- terbilangRatusan() : string
- Helper function to spell numbers from 1 to 999.
Functions
hargaTerbilang()
Converts a number to its Indonesian word representation for currency.
hargaTerbilang(int|float $angka) : string
For example: 12500 will be converted to "Dua Belas Ribu Lima Ratus Rupiah".
Parameters
- $angka : int|float
-
The numeric value to convert.
Return values
string —The spelled-out price in Bahasa Indonesia.
terbilangRatusan()
Helper function to spell numbers from 1 to 999.
terbilangRatusan(int $angka) : string
This is used by the main hargaTerbilang() function.
Parameters
- $angka : int
-
The number between 1 and 999.
Return values
string —The spelled-out number segment.