PHP If ElsePHP if else statement is used to test condition. There are various ways to use if statement in PHP. PHP If StatementPHP if statement allows conditional execution of code. It is executed if condition is true. If statement is used to executes the block of code exist inside the if statement only if the specified condition is true. Syntax Flowchart Example Output: 12 is less than 100 PHP If-else StatementPHP if-else statement is executed whether condition is true or false. If-else statement is slightly different from if statement. It executes one block of code if the specified condition is true and another block of code if the condition is false. Syntax Flowchart Example Output: 12 is even number PHP If-else-if StatementThe PHP if-else-if is a special statement used to combine multiple if?.else statements. So, we can check multiple conditions using this statement. Syntax Flowchart Example Output: B Grade PHP nested if StatementThe nested if statement contains the if block inside another if block. The inner if statement executes only when specified condition in outer if statement is true. Syntax Flowchart Example Output: Eligible to give vote PHP Switch Example Output: 34 is smaller than 56 and 45 Next TopicPHP Switch |