PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
dstefani
Forum Contributor
Posts: 140 Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA
Post
by dstefani » Sat Feb 24, 2007 2:31 pm
How do I get a comma in a US dollar amount like $1925.95 to $1,925.95
Is the a way to format it, or do I have to do a regexp or something?
Thanks,
- dstefani
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Feb 24, 2007 2:36 pm
dstefani
Forum Contributor
Posts: 140 Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA
Post
by dstefani » Sat Feb 24, 2007 3:19 pm
OK, that's cool, but how about this:
I've got a number of 1200 I'm using sprint to add the two zeros after the decimal. It works.
How do I get the comma and the effect of sprintf ? ($1,200.00)
Maybe I'm missing something.
Thanks,
- dstefani
nickvd
DevNet Resident
Posts: 1027 Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:
Post
by nickvd » Sat Feb 24, 2007 3:36 pm
dstefani wrote: OK, that's cool, but how about this:
I've got a number of 1200 I'm using sprint to add the two zeros after the decimal. It works.
How do I get the comma and the effect of sprintf ? ($1,200.00)
Maybe I'm missing something.
Thanks,
- dstefani
I really don't mean to be rude.. but did you even read the manual page for money_format() that feyd posted???
It certainly doesn't seem like it.
dstefani
Forum Contributor
Posts: 140 Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA
Post
by dstefani » Sat Feb 24, 2007 3:42 pm
It's OK, be rude, I scanned it, I'm doind 3 things at one.
When I posted the last one I felt a shiver of guilt as I posted (didn't do enough of my own research)
- Sorry
- dstefani
Evil laziness