Saved Bookmarks
| 1. |
Explain if else statement in PHP? |
|
Answer» If else statement in PHP: If statement executes a statement or a group of statements if a specific condition is satisfied by the user expectation. When the condition gets false (fail) the else block is executed. Syntax: if (condition) { Execute statement(s) if condition is true; } else { Execute statement(s) if condition is false; } Example: <?php $pass_Mark = 35; $Student_Mark = 70; if($Student_Mark>=$Pass_Mark) { echo “The Student is eligible for the promotion”; } else { echo “The Student is not eligible for the promotion”; } ?> |
|