Condition Control Statements -
These are used to executed the statement of block of statements according
to some condition. it test the condition First if
condition is true then it execute the first statement .otherwise
execute second condition.There types are given below .
if Statement it is the Basic condition control statement in this we can use single condition .the if statement allows a programmer to test the value of conditional expression and to select or reject the execution of the statement of block of statements depending on this value..if the condition is true then statement is executed .
Syntax :
if (Condition )
{
statement 1;
statement 2;
}
if else statement it can perform the two different operation in the program .if condition is true then execute the first statement ..if condition is wrong then it execute the wrong part ..
Syntax
if (condition )
{
statement 1;
}
else
{
statement 2;
}
Program
<?php
$a=45;
if($a>33)
{
echo "student is
pass" ;
}
else
{
echo "student is
fail" ;
}
?>
if else if if we have more than two conditions then we use if else if statement. in this we can create multiple blocks of statements and statements will execute according to the condition .
Syntax
if (condition )
{
statement ;
}
else if
{
statement ;
}
else
{
wrong statement ;
}