Re: Formatting Percents

From: Date: Fri, 17 Aug 2001 05:05:08 +0000
Subject: Re: Formatting Percents
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63132@lists.php.net to get a copy of this message
On Fri, 17 Aug 2001 14:19, David Smith wrote: > What I have in code. > > If the retail price is $139.95 and I use the following: > > $aprice = $hotbuys["price"] * .15; // Determine Discount > $bprice = $hotbuys["price"] - $aprice; // Subtract Discount > > $bprice = 118.9575 > > How can I format that to just 118.96? $discount = .15; $discount_price = number_format($hotbuys["price"]*(1-$discount), 2) should do something like what you want. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA It's smart to pick your friends, but not to pieces.

« previous php.general (#63132) next »