PHP Conditional Statement


Sometimes, we need to perform different actions based on different conditions.
It can be perform with the help of Relational operator or conditional statement

Conditional Operator

OperatorDescriptionExampleResult
>greater than.a=4,b=2 ;     a>ba is greater than b
<less than.a=2,b=4 ;     aa is less than b
>=is greater than or equal to.

<=is less than or equal to.

==is equals to.a=2,b=2 ;    a==ba is equals to b
!=is not equals to.a=2,b=4 ;    a!=ba is not equals to b

Relational Operator

OperatorDesriptionExample
&&ANDif both condition true than statement will be execute
||ORany one condition true than statement will be execute
!NOTNOT

Types of conditional Or Branch Statements