jasonc Posted July 16, 2011 Share Posted July 16, 2011 say my number is 1.2 i would like to have it show as 1.20 at two decimal places what is the correct method to do this. Link to comment https://forums.phpfreaks.com/topic/242145-display-variable-at-two-decimal-places/ Share on other sites More sharing options...
wildteen88 Posted July 16, 2011 Share Posted July 16, 2011 Use number_format or sprintf Link to comment https://forums.phpfreaks.com/topic/242145-display-variable-at-two-decimal-places/#findComment-1243551 Share on other sites More sharing options...
silkfire Posted July 16, 2011 Share Posted July 16, 2011 Easy, mate! $number = number_format(1.2, 2); Link to comment https://forums.phpfreaks.com/topic/242145-display-variable-at-two-decimal-places/#findComment-1243578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.