An If statement can be followed by an optional else statement, which executes when the Boolean expression is false.
The syntax of if....else statement in Php is
if(condition)
{
/* statements will execute if the condition is true */
}
else
{
/* statements will execute if condition will false */
}
If all the conditions get true then 'if' block will be executed, otherwise 'else' block will be executed.
Example :-
Output of the above code
No comments:
Post a Comment