
Jasmine
Administrator
/ Moderator
Feb 24, 2000, 11:35 PM
Post #2 of 2
(261 views)
|
|
Re: rounding numbers to 2 decimal places?
[In reply to]
|
Can't Post
|
|
To round numbers, you can use the sprint function. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $a = 124.316343; $b = sprintf("%.2f", $a); print $b; # prints 124.32 </pre><HR></BLOCKQUOTE> You can change the number of decimal places by changing the 2 in "%.2f" to the number of decimal places you want to use.
|