Menampilkan ribuan di php


number_format ( float $number , int $decimals = 2 , string $dec_point = ‘,’ , string $thousands_sep = ‘.’ )

$number = angka yang akan kita format
$decimal = jumlah angka dibelakang koma
$dec_point = pemisah nominal dengan desimalnya (koma)
$thousands_sep = pemisah bilangan dalam ribuan (biasanya titik)

contoh :
$nilai=300000
$ribuan=number_format($nilai,0,’,’,’.’);

apabila ingin menampilkan 2 angka di belakang koma
$duablkgkoma=number_format($nilai,2,’,’,’.’);

ref : http://bukuteman.blogspot.com/2011/12/menampilkan-format-angka-dalam-rupiah.html

Advertisement

Published by

susiloharjo

Khoirunnas anfa'ahum linnas A Father, Husband and love to learn person Love my Family, Electronics, Photography, Robot, Dreaming, Programming

Ditunggu komennya ...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.