azraelGG Posted March 19, 2013 Share Posted March 19, 2013 hi im doin some custom coding and i need use ROUND with ALWAYS 2 decimals so if i enter 2 i need get back 2,00 with , not . Quote Link to comment https://forums.phpfreaks.com/topic/275848-echo-prices/ Share on other sites More sharing options...
Solution PaulRyan Posted March 19, 2013 Solution Share Posted March 19, 2013 (edited) Try this: <?PHP $myNumber = 2; $number = number_format(ROUND($myNumber), 2, ',', ''); echo $number; Edited March 19, 2013 by PaulRyan Quote Link to comment https://forums.phpfreaks.com/topic/275848-echo-prices/#findComment-1419515 Share on other sites More sharing options...
azraelGG Posted March 19, 2013 Author Share Posted March 19, 2013 Try this: <?PHP $myNumber = 2; $number = number_format(ROUND($myNumber), 2, ',', ''); echo $number; i tried with sprinf wrong way to do it this works great, thanks Quote Link to comment https://forums.phpfreaks.com/topic/275848-echo-prices/#findComment-1419517 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.