RE: [PHP] money maths

From: Date: Mon, 12 Feb 2001 10:46:34 +0000
Subject: RE: [PHP] money maths
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39205@lists.php.net to get a copy of this message
Brilliant! Once again this list proves to be one of the wonders of the world. Problem solved in 10 minutes or less. Thanks again. On Mon, 12 Feb 2001, Martin E. Koss wrote: > Try the number_format > example: > $Price = number_format($BasePrice,2); > > Martin. > > -----Original Message----- > From: Michael Hall [mailto:lists@mulga.com.au] > 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 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 > solution to this, including regex? I can't find anything among > the maths functions. > > Thanks > > Mick > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#39205) next »