0% found this document useful (0 votes)
23 views6 pages

Decision Making: Etl Labs PVT LTD - PHP

The document discusses different conditional statements in PHP including if, if/else, if/elseif/else, and switch statements. The if statement executes code if a condition is true. The if/else statement executes one code if the condition is true and another if it is false. The if/elseif/else statement checks for multiple conditions. Finally, the switch statement selects one of many code blocks to execute based on different conditions.

Uploaded by

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

Decision Making: Etl Labs PVT LTD - PHP

The document discusses different conditional statements in PHP including if, if/else, if/elseif/else, and switch statements. The if statement executes code if a condition is true. The if/else statement executes one code if the condition is true and another if it is false. The if/elseif/else statement checks for multiple conditions. Finally, the switch statement selects one of many code blocks to execute based on different conditions.

Uploaded by

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

Decision Making

ETL LABS PVT LTD – PHP 56


if Statement
The if statement executes some code if one
condition is true.

Syntax 1
if (condition)
{
code to be executed if condition
is true;
}

ETL LABS PVT LTD – PHP 57


if...else Statement
The if....else statement executes some code
if a condition is true and another code if that
condition is false.

Syntax
2 if (condition)
{
code to be executed if condition is
true;
}
else
{
code to be executed if condition is
false;
}

ETL LABS PVT LTD – PHP 58


if...elseif....else Statement
The if....elseif...else statement executes
different codes for more than two conditions.
Syntax
if (condition)
{
code to be executed if this condition
is true;
}
elseif (condition)
3
{
code to be executed if this condition
is true;
}
else
{
code to be executed if all conditions
are false;
}

ETL LABS PVT LTD – PHP 59


switch Statement
The if....elseif...else statement executes
different codes for more than two conditions.
Use the switch statement to select one of
many blocks of code to be executed.
As shown in Syntax

ETL LABS PVT LTD – PHP 60


Example of switch Statement

ETL LABS PVT LTD – PHP 61

You might also like