globex Posted December 18, 2007 Share Posted December 18, 2007 I'm dealing with money, is there a way to convert a variable containing "2" to "2.00"? Quote Link to comment https://forums.phpfreaks.com/topic/82140-solved-adding-decimals-from-2-to-200/ Share on other sites More sharing options...
corbin Posted December 18, 2007 Share Posted December 18, 2007 http://php.net/number_format That should help. Quote Link to comment https://forums.phpfreaks.com/topic/82140-solved-adding-decimals-from-2-to-200/#findComment-417404 Share on other sites More sharing options...
~n[EO]n~ Posted December 18, 2007 Share Posted December 18, 2007 <?php $number = 2; echo number_format ($number, 2); ?> Oops... Quote Link to comment https://forums.phpfreaks.com/topic/82140-solved-adding-decimals-from-2-to-200/#findComment-417407 Share on other sites More sharing options...
globex Posted December 18, 2007 Author Share Posted December 18, 2007 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/82140-solved-adding-decimals-from-2-to-200/#findComment-417411 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.