Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Else Statement | Умовні Оператори
Вступ до PHP

Else Statement

An if can be followed by an optional else block. The else block will execute if the Boolean expression tested by the if block evaluates to false.

if else

Let's consider a example:

main.php

main.php

12345678
<?php $age = 17; if ($age >= 18) { echo "You're an adult"; } else { echo "You're not an adult yet."; } ?>

In the example above, the age < 18, so the if code block hasn't been executed. The else code block executes when the if condition is false.

The else syntax is like the if syntax without a condition and parentheses ( ).

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 2
single

single

Else Statement

Свайпніть щоб показати меню

An if can be followed by an optional else block. The else block will execute if the Boolean expression tested by the if block evaluates to false.

if else

Let's consider a example:

main.php

main.php

12345678
<?php $age = 17; if ($age >= 18) { echo "You're an adult"; } else { echo "You're not an adult yet."; } ?>

In the example above, the age < 18, so the if code block hasn't been executed. The else code block executes when the if condition is false.

The else syntax is like the if syntax without a condition and parentheses ( ).

Завдання

Проведіть, щоб почати кодувати

Fill in the blanks in the code to check the identity of variables $var1 and $var2 using the if ... else construct.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 2
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

some-alt