Re: [PHP] money maths

2001-02-12 Thread Christian Reiniger
On Monday 12 February 2001 11:34, Michael Hall wrote: > this works fine except that 14.95 * 2 comes out as 29.9 not 29.90. In > other words, how to add a zero so that there are always two decimal > places. Any solution to this, including regex? I can't find anything look for number_format() and s

RE: [PHP] money maths

2001-02-12 Thread Michael Hall
-Original Message- > From: Michael Hall [mailto:[EMAIL PROTECTED]] > Sent: 12 February 2001 10:35 > To: PHP List > Subject: [PHP] money maths > > > > I'm building a demo shopping cart and have sorted out most things but > this: > > I have php work out s

RE: [PHP] money maths

2001-02-12 Thread Martin E. Koss
Try the number_format example: $Price = number_format($BasePrice,2); Martin. -Original Message- From: Michael Hall [mailto:[EMAIL PROTECTED]] Sent: 12 February 2001 10:35 To: PHP List Subject: [PHP] money maths I'm building a demo shopping cart and have sorted out most thing

[PHP] money maths

2001-02-12 Thread Michael Hall
I'm building a demo shopping cart and have sorted out most things but this: I have php work out subtotals by multiplying $quantity * $price ... this works fine except that 14.95 * 2 comes out as 29.9 not 29.90. In other words, how to add a zero so that there are always two decimal places. Any so