logo

Crowdly

Дано код: $prices = ["100", 100.0, "100.00", 99.99]; $total = 0; foreach($...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Дано код:

$prices = ["100", 100.0, "100.00", 99.99];

$total = 0;

foreach($prices as $price) {

    if ($price == 100) {

        $total += $price;

    }

}

echo "Total: $total";

Питання:

А) Що буде виведено? Скільки елементів додалось до total?

Б) Чому "100.00" тоже вважається рівним 100?

В) Як змінити перевірку, щоб враховувати типи і додавати тільки точні 100?

More questions like this

Want instant access to all verified answers on moodle.elct.lnu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!