/* */ Click to Join Live Class with Shankar sir Call 9798158723

PHP Conditional Statements ?


Types of conditional statements in PHP :-

  1. Single If statement
  2. If else statement
  3. else if ladder statement
  4. switch statement
Conditional Statements

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


Conditional Operator
Operator Description Example Result
> greater than. a=4,b=2 ;     a>b a is greater than b
< less than. a=2,b=4 ;     a a is less than b
>= is greater than or equal to.

<= is less than or equal to.

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


Relational Operator
Operator Desription Example
&& AND if both condition true than statement will be execute
|| OR any one condition true than statement will be execute
! NOT NOT