Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $buyList = array(
- array('name' => 'Телевизор', 'price' => '400', 'quantity' => 1),
- array('name' => 'Телефон', 'price' => '300', 'quantity' => 3),
- array('name' => 'Кросовки', 'price' => '150', 'quantity' => 2),
- );
- function resultBuyList($buyList)
- {
- foreach ($buyList as $key => $value) {
- $credits = $value['quantity'] * $value['price'];
- $creditCount += $credits;
- $productCount += $value['quantity'];
- }
- return $result = "Вы купили $productCount единиц товара, общая сумма к оплате: $creditCount";
- }
- resultBuyList($buyList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement