View Full Version : Resolved displaying dollars and cents
09-10-2009, 08:42 PM
Is there a PHP function to display a variable to two decimal places?
EG if $price="3.5" I still want it to display as "3.50".
09-10-2009, 08:50 PM
09-10-2009, 08:58 PM
Thanks! I knew there had to be a function to do it.
You can also do:
if you want commas at the thousands/millions/etc.
09-10-2009, 09:02 PM
it will automatically add in commas where needed without the extra arguments.
09-11-2009, 04:27 AM
Uses more memory and time, but will adhere to the setlocal value if you want to change the currency.
09-11-2009, 01:23 PM
money_format() only works on linux servers. You're most likely on one, but keep that in mind if you use it.
09-11-2009, 03:26 PM
php can do anything ;D
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.