money maths

From: Date: Mon, 12 Feb 2001 10:34:38 +0000
Subject: money maths
Groups: php.general 
Request: Send a blank email to php-general+get-39202@lists.php.net to get a copy of this message
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

« previous php.general (#39202) next »