Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sum of array value

$total = 0;
foreach ($products as $product) {
    $subtotal = $product['price']*$product['quantity'];
    $total += $subtotal;
}

echo $total;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #array
ADD COMMENT
Topic
Name
1+3 =