Basically I am trying to multiply values together.
I have a ul below that is echo’ing out a numeric value,:
<ul class="TCE">
<li><span>Average drink cost</span> <?php echo the_field('average_drink_price'); ?></li>
<li><span>Average drinks spenditure per night</span> <?php echo the_field('average_drinks_spenditure_per_night'); ?></li>
<li><span>Average drinks spenditure for the year</span> <!-- JAVA BIT --></li>
<li><span>Average drinks spenditure for 3 years</span> <!-- JAVA BIT --></li>
</ul>
I want the third li to get the value of the second li and then multiply that value by exactly 28.
I then want the fourth li to get the value of the third li and multiply that by 3.
So it goes a little like this:
li-2 x 28 = li-3
li-3 x 3 = li-4
If that makes sense? The value’s for li1 and li2 will be generated via that PHP field, any help on this as I have no idea where to start?
Updated PHP testing:
<?php
var_dump(the_field('average_drinks_spenditure_per_night'));
$li2 = the_field('average_drinks_spenditure_per_night');
$li3 = ($li2 * 28) * 2.1;
$li4 = $li3 * 3;
?>
<ul class="TCE">
<li><span>Average drink cost</span> <?php echo the_field('average_drink_price'); ?></li>
<li><span>Average drinks spenditure per night</span> <?php echo $li2; ?></li>
<li><span>Average drinks spenditure for the year</span> <?php echo $li3;?><!-- JAVA BIT --></li>
<li><span>Average drinks spenditure for 3 years</span> <?php echo $li4;?><!-- JAVA BIT --></li>
</ul>
TRY