Jump to content

Add trailing zero to calculation


jester626

Recommended Posts

This is probably pretty simple but I can't seem to find the exact answer I am looking for.

 

I am pulling a couple of numbers from a database (productcost and productprice).  I am trying to subtract the cost from the price to calculate the profit of the item.  I have this part working with no problem. My problem lies when the final number has a trailing zero it will drop that number (i.e. 1.2 as opposed to 1.20)

 

Here is what I am using:

$profit = $row_viewcoils['ProductPrice'] - $row_viewcoils['ProductCost'];

echo $profit;

 

Any help would be greatly appreciated

 

 

Link to comment
https://forums.phpfreaks.com/topic/69925-add-trailing-zero-to-calculation/
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.