Log 2589
20/01/2024 2024-01-20 20:26// Sample input data
$products = array(“Product 1”, “Product 2”, “Product 3”);
$quantities = array(10, 20, 30);
// Initialize an empty string to store the result
$result = “”;
// Loop through each product and quantity
for ($i = 0; $i < count($products); $i++) {
// Get the current product and quantity
$product = $products[$i];
$quantity = $quantities[$i];
// Concatenate the product name with its quantity separated by a colon (:)
$result .= "{$product}:{$quantity} ";
}
// Echo the final result
return trim($result);