MySQL Forums
Forum List  »  PHP

Re: force php to display 2 decimal points
Posted by: Peter Brawley
Date: March 27, 2006 08:45AM

Display right justified with 10 digits, 2 decimal places:

printf("%10.2f\n", $number );

To "print" to a variable use sprintf with the same args.

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: force php to display 2 decimal points
March 27, 2006 08:45AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.