chrisbcats Posted June 6, 2006 Share Posted June 6, 2006 How do I format php variables?I have several calculated php variables. How do I format the variables in decimal and whole number format?ex:$netValue = 874.76233$net = 8952038I need the variables to return:$netValue = 874.76$net = 8,952,038 Quote Link to comment https://forums.phpfreaks.com/topic/11302-solved-format-variables/ Share on other sites More sharing options...
KrisNz Posted June 6, 2006 Share Posted June 6, 2006 [a href=\"http://php.net/printf\" target=\"_blank\"]printf[/a] is what you're after Quote Link to comment https://forums.phpfreaks.com/topic/11302-solved-format-variables/#findComment-42325 Share on other sites More sharing options...
wildteen88 Posted June 6, 2006 Share Posted June 6, 2006 or [a href=\"http://uk2.php.net/manual/en/function.number-format.php\" target=\"_blank\"]number_format[/a] [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/11302-solved-format-variables/#findComment-42441 Share on other sites More sharing options...
chrisbcats Posted June 7, 2006 Author Share Posted June 7, 2006 Thank you both! I better understood number_format. Quote Link to comment https://forums.phpfreaks.com/topic/11302-solved-format-variables/#findComment-42654 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.