0% found this document useful (0 votes)
5 views8 pages

Topic 4

Uploaded by

Storage Device
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Topic 4

Uploaded by

Storage Device
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Lesson 3 –

Conditional
Statements
Prepared by:

Prof Jays
PHP If...Else Statements
• Conditional statements are used to perform different actions
based on different conditions.
• In PHP we have the following conditional statements:
– if statement - use this statement to execute some code only if a
specified condition is true
– if...else statement - use this statement to execute some code if a
condition is true and another code if the condition is false
– if...elseif....else statement - use this statement to select one of
several blocks of code to be executed
– switch statement - use this statement to select one of many
blocks of code to be executed
The if Statement
Syntax

Example:
The if...else Statement
Syntax

Example:
If more than one line should be executed if
a condition is true/false, the lines should
be enclosed within curly braces:
The if...elseif....else Statement
Syntax
PHP Switch Statement
Syntax

You might also like