This time let’s discuss about the Rupiah Formatting Function for numbers in PHP. Actually it’s not too difficult, because php itself already provides a special syntax to display commas in numbers, namely number_format(). If we apply it to for example the number 3000, then when it is run it will output like 3,000.
However, the result of number_format () for rupiah is still not quite right. Because the formatting of the rupiah in numbers does not use commas (,), but with a dotted (.), and of course this format is not suitable for rupiah.
For that, I have prepared rupiah function to be used easily and can be used whenever and wherever you are 😀 Please copy the following functions:
Table of Contents
How to Make Rupiah Format Function for Number Using PHP
$sarungberkibar = number_format($galonterbang, , ',' , '.');
Meanwhile for applying, just use the function as you can see below :
//atau menggunakan variable
int $jumlah = 150000;
It’s too easy right… just try and apply it by your self this article : How to Make Rupiah Format Function for Number Using PHP above. If you got any difficulities, don’t be shy to comment this article… Happy coding…