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:
How to Make Rupiah Format Function for Number Using PHP
1 2 3 4 5 6 |
<?php function rupiah($galonterbang){ $sarungberkibar = number_format($galonterbang, 0 , ',' , '.'); return $sarungberkibar; } ?> |
Meanwhile for applying, just use the function as you can see below :
1 2 3 4 5 6 7 |
<?php //tanpa variable echo rupiah(150000); //atau menggunakan variable int $jumlah = 150000; echo rupiah($jumlah); ?> |
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…
Hi. I have checked your detriamelia.com and i see you’ve got some duplicate content so probably it is
the reason that you don’t rank hi in google.
But you can fix this issue fast. There is a tool that
creates articles like human, just search in google: miftolo’s tools