stublackett Posted September 5, 2008 Share Posted September 5, 2008 Hi, I've got a Calculation script running, The problem I have is that when it does the calculation it is not coming out with two decimal points, Its coming out with just one i.e My Script says : Total Cost for this purchase : £175.5 What I'd like it to say is Total Cost for this purchase : £175.50 How do I make this possible? The calculation goes as follows : <?php //Calculate Total $reducedrate = $_POST['reduced_rate']; $newrate = 8.50 * $reducedrate; $total = 150 * $numberofpeople + $newrate; Just for the purposes of this $reducedrate = 4 and numberofpeople = 1 Quote Link to comment Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 use number_format function Quote Link to comment Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 $total = number_format($total,2); Quote Link to comment Share on other sites More sharing options...
stublackett Posted September 5, 2008 Author Share Posted September 5, 2008 Thanks! *SOLVED* Quote Link to comment 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.