I am making a calculator for a website, with a starting price then optional extras that a user selects.
So say the price was £11,345 and two extras were selected at £450 and 1,300 your total would be £13, 095.
I have done my calculations just with the numbers, so 11345 + 450 + 1300.
This is where my problem is, as my total would be simply be the number 13095, when I echo it, it wont produce the comma after the first two numbers.
Is there a way that I can take a string and insert a comma after the second character?
Change string to a price
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
number_format
Just for informational purposes, It should be noted that in germany number format is different. 10.000,56 where comma is the decimal point and thousands separator is a dot.
Just for informational purposes, It should be noted that in germany number format is different. 10.000,56 where comma is the decimal point and thousands separator is a dot.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
money_format() might be of interest too.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK