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. Link to comment https://forums.phpfreaks.com/topic/217227-tenths-question/ Share on other sites More sharing options...
Pikachu2000 Posted October 29, 2010 Share Posted October 29, 2010 round() Link to comment https://forums.phpfreaks.com/topic/217227-tenths-question/#findComment-1128104 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(). Link to comment https://forums.phpfreaks.com/topic/217227-tenths-question/#findComment-1128105 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, ',', '.'); Link to comment https://forums.phpfreaks.com/topic/217227-tenths-question/#findComment-1128130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.