Jump to content

Subtraction in php! - need a bit of help (it should be simple!)


mr_c

Recommended Posts

hey guys, i'm new to the forum and php! I need to edit some php in a shopping cart software that uses php and i'm trying to subtract two variables with each other like this but with no results:

 

What i need to work:

1-

{convertPrice price=$product->getPriceWithoutReduct()-$product->getPrice()}

 

2-

{convertPrice price=$product->getPriceWithoutReduct()}{convertPrice price=$product->getPrice()}

 

 

what is so confusing to me is that line number 2 shows the values of both variables in the browser, for example: £10 £9. All i want is for those two vars to subtract each other so i would get £1 in that example.

 

 

and if i try this:

 

{convertPrice price=$product->getPriceWithoutReduct()-2}

or

{convertPrice price=$product->getPrice()-2}

 

the browser shows the value - 2! so it only breaks when i try to subtract each other

 

 

is there any way i can subtract those two variables?

 

thanks in advance guys

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.