Multiplying Variable

Hello,

I am trying to multiply the price by a number but the price is a variable field.

echo ‘’.$content[‘prodName’].’ on sale at ‘.$content[‘prodCurrency’].$content[‘prodPrice’].’ Delivered right to your door
Free delivery

’;

echo ’ ‘.$content[‘prodDescription’].$content[‘prodDescription’].’

’;

echo ‘Only ‘.$content[‘prodCurrency’].$content[‘prodPrice’].’

’;

It is the .$content[‘prodPrice’].’ That I need to multiply by a factor (i.e. .$content[‘prodPrice’].* 5) but this does not work, any help much appreciated.

Thanks.

You need to remove the period after the variable in your example…
[php]$content[‘prodPrice’]*5[/php]

In some cases, especially when concatenating next to a digit, you may need to use parenthesis:[php]‘Something’.($content[‘prodPrice’]*5).‘something else’[/php]

Thanks

My pleasure. If you have any trouble implementing it, let me know.

jay

Sponsor our Newsletter | Privacy Policy | Terms of Service