Function Format Rupiah (IDR) pada PHP

28/02/2022  •  198 views
 
 <?php 
 function idr($nominal)
 {
 $hasil = number_format($nominal, 0,",",".");
 return $hasil;
 }
 ?>

<?php
$balance = 500000;
$idr_balance = idr($balance);

echo $idr_balance;

// Output: 50.000

?>
 English / Indonesian