Re: Number formatting
| From: | Shane Wright | Date: | Thu, 06 Jun 2002 17:43:03 +0000 |
| Subject: | Re: Number formatting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100974@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
> $aprTemp = number_format($apr, 2); which in the case of 3.05 will return
> 305.00 and 300.00 for 3%. Anyone have a snippet to test and display
> properly so that 3% would be 3.00, etc.
you could try this...
$val = sprintf("%0.02f", $val);
Cheers
- --
Shane
www.shanewright.co.uk
Public key: http://www.shanewright.co.uk/files/public_key.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8/58q5DXg6dCMBrQRApb0AJsFZ7WxZK5PRguKZqNbRndVUnkl/QCgpafj
VWVFBaJ9ysYxJqNP3Bxm2EI=
=zrZI
-----END PGP SIGNATURE-----