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"? 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. 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... 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 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
Archived
This topic is now archived and is closed to further replies.