Trailing zeros missing after subtraction

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 27, 2011   (RSS)

Re: [gkornbluth] Trailing zeros missing after subtraction

By Jason - January 27, 2011

Hi Jerry,

What you can do is use number_format to force a certain number of decimal places.

Example:

<?PHP if ($CURRENT_USER['registration_fee_refund'] == 1): ?><?php echo number_format(($price_a - $deposit_amount),2); ?><?php else: ?><?php echo number_format($price_a,2); ?><?PHP endif ?>

This will force 2 decimal places to your number, even if they're zeros.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Trailing zeros missing after subtraction

Thanks,

I (erroneously) thought that it would be enough to include number_format in the defined variables.

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php