它是Virtuemart,但它更基本的PHP的东西...显示最后一个数组元素
我需要一些帮助/提示...
我想要做什么 - 我想显示TAXAMOUNT总和只有在Virtuemart购物车中有一些ID的折扣(这是 - >我想每个折扣类型显示单独的折扣)。
这里是我想到目前为止:
foreach ($this->cart->products as $pkey => $prow)
{
if ($prow->product_discount_id==2)
{
$discounts= $this->cart->pricesUnformatted[$pkey]['discountAmount'];
$discountss+=$discounts;
echo "<span class='priceColor2'>" . $discountss . "</span>" ;
}
}
转Bt基因的问题是,它echo'ing所有优惠总和(同时的foreach是真的)......我怎么能只显示最后一个元素或也许最好使用不同的解决方案
TNX!
我将从PHP手册开始http://us2.php.net/array_pop – Dave