jwk811 Posted February 23, 2007 Share Posted February 23, 2007 my shipping calculator doesnt always come out with a price with exact cents.. how can i make sure it goes only two digits which i would do by rounding? Link to comment https://forums.phpfreaks.com/topic/39754-make-it-only-two-digits-after-decimal/ Share on other sites More sharing options...
suzzane2020 Posted February 23, 2007 Share Posted February 23, 2007 try this use the round function $dec=12.234; $new=round($dec,2); Link to comment https://forums.phpfreaks.com/topic/39754-make-it-only-two-digits-after-decimal/#findComment-191985 Share on other sites More sharing options...
Barand Posted February 23, 2007 Share Posted February 23, 2007 ... or output it using echo number_format($result,2); Link to comment https://forums.phpfreaks.com/topic/39754-make-it-only-two-digits-after-decimal/#findComment-191992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.