businessman332211@hotmail.com Posted July 3, 2006 Share Posted July 3, 2006 Sorry for the caps, I am about to disown php, I am trying to get something to go up decimal places, but nothing is working, I asked here in a seperate post, because my other post I had a more important question.I have numbers coming in the db as 2.140 sometimes or 3.300or 4.000 I need them to ALWAYS be 3 decimal places like add zero's to pop int he other decimals I tried everything, I tried str_pad, round(), number_format and nothing is seeming to work, I even played with sprintf, and printr but nothing is working, can someone please help with this.The entries are put into a mysql database, and they are suppose to disply with 3 decimals when the database calls them. But even when there recorded in the database, they pull off the zero's Link to comment Share on other sites More sharing options...
adservio Posted July 3, 2006 Share Posted July 3, 2006 Are you sure you are using number_format correctly? <?php$x = 1233.2;echo number_format( $x, 3, '.', ',');?> This should give you 3 decimal places. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now