PHP Decision Making

Decision Making Statement allows computer to decide block of code to be execute based on the condition.if, if … else,if … else if and switch statements are used as decision making statements in PHP.

The if Statement in PHP

Block of statement executed only when a specified condition is true.

The If…Else in PHP

When we want to execute some block of code if a condition is true and another block of code if a condition is false, In such a case we use if….else statement.

The if … else if Statement in PHP

The if….elseif…else statement is used to select one of among several blocks of code to be executed.

The Switch case statement in PHP

The switch statement is simplified form of the nested if … else if statement , it avoids long blocks of if..elseif..else code.