Change string to a price
Posted: Tue Jan 30, 2007 5:49 am
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?
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?