alejandro52 Posted October 29, 2010 Share Posted October 29, 2010 i divide two number but the result is something like 4,5555555. I want to show the two tenths after the , and to round it up so the result to look like 4,56. What is the function to do that? I know it's preaty easy. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2010 Share Posted October 29, 2010 round() Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2010 Share Posted October 29, 2010 If you need to use a comma as a separator, you might also need to look into number_format(). Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 29, 2010 Share Posted October 29, 2010 If you need to use a comma as a separator, you might also need to look into number_format(). You can just use number_format() by itself since it can round as well as format: number_format($input, 2, ',', '.'); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.