Jump to content

subtracting and keeping decimals


wright67uk

Recommended Posts

How can I subtract from a variable, but keep my decimal places?

 

When I try the below example I return 0

 

<?php $a = $_attributeSelection["backp1"];  echo $a -1;  ?> // 1.53 becomes 0
 
However When I try the below example i return 0.69
 <?php $b = 1.69; echo $b-1;?> // 1.69 becomes 0.69
 

 

 

Link to comment
https://forums.phpfreaks.com/topic/275125-subtracting-and-keeping-decimals/
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.