PHP TutorialLesson 16Free preview
PHP If...Else...Elseif
This lesson is part of PHP · All levels
Summary
The if... structure allows the program to select actions based on certain conditions. This lesson explains how to write if, else, and elseif, including alternative writing with colon and endif marks. With this structure, the program can make different decisions for different situations anyway.
Key points
- If you check the condition in the lock, the block is executed if
- Else becomes an option when the condition if is worth false
- Otherwise, check the additional conditions in sequence.
- Conditions often use comparison operators such as >, <, ==, and ===
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.