Add commas as thousands separator and floating point dot in php -


i have this

$example = "1234567" $subtotal =  number_format($example, 2, '.', ''); 

the return of $subtotal "1234567.00" how modify definition of $subtotal, make "1,234,567.00"

below output 1,234,567.00

$example = "1234567"; $subtotal =  number_format($example, 2, '.', ','); echo $subtotal; 

syntax

string number_format ( float $number , int $decimals = 0 , string $dec_point = '.' , string $thousands_sep = ',' ) 

but advise use money_format formats number currency string


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -