Use
foreach:
PHP Code:
foreach($array as $value)
{
$id_quantity_pair = explode("-", $value); // Uses Hyphen(-) as delimiter to separate product ID from its quantity
$product_id = $id_quantity_pair[0]; // Get the product ID
$product_quantity = $id_quantity_pair[1];
//Do calculation to get Total Price for this Item
//E.g
//Get price from DB in $price using Product ID like $product_array = mysqli_fetch_array(mysqli_query($db, "SELECT * FROM products WHERE product_id = $product_id")); $price = $product_array['price'];
$total_price[] = $price * $product_quantity;
}