0

I have two variables which are

$product['productsPrice']

which contains $15.40 and

$product['productsPriceEach']

which contains $7.70

I need to be able to perform a simple calculation of

$new_value = $product['productsPrice'] - $product['productsPriceEach']

but no matter what i try i can't get anything other than 0 as an answer.

I tried using

(int)$product['productsPrice']

also tried (float)$product['productsPrice'] I then tried assigning $product['productsPrice'] to a new var so that i could test

(int)$productsPrice

or (float)$productsPrice.

Then I used str to drop the $ sign and tried (int) and (float) again but still get 0 as a result.

What am i missing here?

Steve Price
  • 600
  • 10
  • 28

0 Answers0