以下に、PHPで作成されている多くの追加と値があります。
それはすべてうまくいきます!そしてそれはここで実際に見ることができます:http://universitycompare.com
EXCEPT-'$totalcost'を含むPHPの最初のセット。以下で作成した値を使用して合計を作成できない理由がわからないようです。
何か意見はありますか?
<?php
$totalcost = $totalcost2 + $totalcost3;
$totalcost2 = $li444 + $tuitionTotal;
$totalcost3 = $li4 + $li44;
?>
<!-- WORKING OUT TOTAL TCE -->
<p>
<b class="TCE">
<?php echo $totalcost; ?>
<?php echo array_sum($a); ?>
</b>
</p>
<!-- END OF WORKING OUT TOTAL TCE -->
<br /><br />
<h2>
Below is a a breakdown of the total cost of Education:
</h2>
<?php
$li2 = get_field('average_drinks_spenditure_per_night');
$li3 = ($li2 * 28) * 2.1;
$li4 = $li3 * 3;
?>
<div class="TCE">
<br />
<h2>Average spent on socialising</h2>
<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>
<?php
$li22 = (get_field('average_housing_costs_per_week') * 4 );
$li33 = $li22 * 12;
$li44 = $li33 * 3;
?>
<h2>Average spent on living costs</h2>
<ul class="TCE">
<li><span>Housing per week</span> £<?php echo the_field('average_housing_costs_per_week'); ?></li>
<li><span>Housing per month</span> £<?php echo $li22; ?></li>
<li><span>Housing per year</span> £<?php echo $li33; ?></li>
<li><span>Housing for 3 years</span> £<?php echo $li44; ?></li>
</ul>
<div class="clear"></div>
<p><br /></p>
<?php
$li222 = (get_field('average_shopping_trip_price') * 2.25 );
$li333 = $li222 * 12;
$li444 = $li333 * 3;
?>
<h2>Average spent on food shopping</h2>
<ul class="TCE">
<li><span>Average shopping trip </span> £<?php echo the_field('average_shopping_trip_price'); ?></li>
<li><span>Average shopping for the month</span> £<?php echo $li222; ?></li>
<li><span>Average shopping for the year</span> £<?php echo $li333; ?></li>
<li><span>Average shopping for 3 years</span> £<?php echo $li444; ?></li>
</ul>
<?php
$tuitionClass = (get_field('tuition_fees') /28 );
$tuitionTotal = (get_field('tuition_fees') * 3 );
?>
<h2>Average spent on tuition</h2>
<ul class="TCE">
<li><span>Price per Week</span> £<?php echo $tuitionClass; ?></li>
<li><span>Average tuition fee</span> £<?php echo the_field('tuition_fees'); ?></li>
<li><span>Average tuition fee for 3 years</span> £<?php echo $tuitionTotal; ?></li>
</ul>