I have several dollar amounts that I need to add. This is the code I'm currently using:
{php}$totalaffamount = $pendingcommissions + $balance + $withdrawn;
echo $totalaffamount;{/php}
Here are the values of each:
$pendingcommissions = $5.00 USD
$balance = $1000.00 USD
$withdrawn = $393.99 USD
I want to display the total like this:
$1398.99
However I keep getting 0
as the output which I'm guessing is because of the dollar sign and USD that are in the variables... Does anyone know what I need to change my code to for this to work?
Try to use values only for this, using $ signs is not the correct way for adding things up
$pendingcommissions = 5.00;
$balance = 1000.00;
$withdrawn = 393.99;
$total = $pendingcommissions + $balance + $withdrawn;
echo '$'.$total;
:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.