Forum Moderators: coopster

Message Too Old, No Replies

Cut a float variable off after two decimal places?

Is this possible?

         

RoaCH

11:35 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



I'm having a hell of a time with what seems to be something simple. I have a shopping cart on my website which displays the total at the top of the page. My problem is: Whenever the total has a zero in the tenths or hundredths place it will display something like $107.9 or $65. It will also display past the hundredth position such as $5.3341. Is there any way to get these outputs to display as $107.90, $65.00, or $5.33? Hope someone can help. Thanks!

twist

11:46 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



number_format( $number, 2 );

RoaCH

12:01 am on Aug 19, 2005 (gmt 0)

10+ Year Member



Thank you twist!