Jump to content

Archived

This topic is now archived and is closed to further replies.

chrisbcats

*SOLVED* Format Variables

Recommended Posts

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 = 8952038

I need the variables to return:
$netValue = 874.76
$net = 8,952,038

Share this post


Link to post
Share on other sites
[a href=\"http://php.net/printf\" target=\"_blank\"]printf[/a] is what you're after

Share this post


Link to post
Share on other sites
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\" /]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.