day_tripperz Posted March 24, 2007 Share Posted March 24, 2007 I have a page that multiplies an amount of a part by the quantity of that part, then gives a total. For example: PART (costs $5.00, quantity of 3) That yields a total of $15. I want to it say $15.00 and I want it to round to the hundreths place in circumstances where a part may cost $3.6554, for example. How can I achieve this? Link to comment https://forums.phpfreaks.com/topic/44147-number-formatting/ Share on other sites More sharing options...
paul2463 Posted March 24, 2007 Share Posted March 24, 2007 try <a href="http://uk.php.net/number_format"> the manual here </a> Link to comment https://forums.phpfreaks.com/topic/44147-number-formatting/#findComment-214390 Share on other sites More sharing options...
kenrbnsn Posted March 24, 2007 Share Posted March 24, 2007 Use the format_number() function: <?php $price = 5 * 3.6554; echo '$' . number_format($price,2); ?> Ken Link to comment https://forums.phpfreaks.com/topic/44147-number-formatting/#findComment-214392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.