HI
I need help from someone, can anyone show me how to keep a running total of a set of array values.
$_SESSION['cart'] = array( $item => array($quantity,$price));
$totalcost = 0;
foreach($_SESSION['cart'] as $key => $value)
{
// Print out the item name
echo "$key ";
foreach($_SESSION['cart'][$key] as $key => $value)
{
// Print out the quantity and then price
echo "$value ";
}
}
I have a cart that keeps track of each item name as a key and then its price and the quantity. I need someone to show me how to times the quantity by the price and then keep track of it as you go throughj each key and its associates.
Thanks Help Greatly Appreciated