Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

money_format() options

Tags:

php

currency

I am looking at the money_format function in php and confused on how to get it to format the way I want. I do not want USD in front of my string, I want a comma every 3 digits and 2 decimal points so 12345.67 will be formated to $12,345.67

Thanks.

like image 354
JD Isaacks Avatar asked Jun 01 '10 18:06

JD Isaacks


People also ask

How to format number to currency in PHP?

The money_format() function is an inbuilt function in PHP that returns a number formatted as a currency string.

What is money format?

United States (U.S.) currency is formatted with a decimal point (.) as a separator between the dollars and cents. Some countries use a comma (,) instead of a decimal to indicate that separation.


1 Answers

Have you looked at number_format? It's a little easier I think.

print number_format( 1234567, 2, ",", "." ); for example.

like image 144
CharlesLeaf Avatar answered Nov 15 '22 15:11

CharlesLeaf