Jump to content

[SOLVED] Using PHP To Calculate


stublackett

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/122841-solved-using-php-to-calculate/
Share on other sites

Archived

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

×
×
  • Create New...

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.