Jump to content


Photo

Dealing with money


  • Please log in to reply
2 replies to this topic

#1 simonp

simonp
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts

Posted 15 May 2006 - 02:05 PM

Hi,

What would be the best way to deal with rounding money to two decimal places.

At the moment I'm getting 14.1 and I want 14.10

Any ideas greatfully appreciated.

Simon

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 15 May 2006 - 02:15 PM

This should do it...
$number = number_format($number,2);


#3 simonp

simonp
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts

Posted 15 May 2006 - 02:59 PM

[!--quoteo(post=373998:date=May 15 2006, 09:15 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 15 2006, 09:15 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
This should do it...
$number = number_format($number,2);
[/quote]

Thanks SemiApocalyptic - that was easy :)

Simon




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users