xProteuSx Posted December 28, 2008 Share Posted December 28, 2008 I can't believe that I forgot how to do this. Its 4am and I can't seem to find anything useful at php.net. I have numbers, that I would like rounded off to two decimal places. For example: .5 should show up as 0.50 1 should show up as 1.00 I thought this was a float thing? Link to comment https://forums.phpfreaks.com/topic/138628-solved-decimal-places/ Share on other sites More sharing options...
JasonLewis Posted December 28, 2008 Share Posted December 28, 2008 Try using number_format. echo number_format(.5, 2); Link to comment https://forums.phpfreaks.com/topic/138628-solved-decimal-places/#findComment-724840 Share on other sites More sharing options...
xProteuSx Posted December 28, 2008 Author Share Posted December 28, 2008 Yay. Thank you. I was researching float 'stuff' for like 45 minutes at 4 am in the morning! Link to comment https://forums.phpfreaks.com/topic/138628-solved-decimal-places/#findComment-724952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.