IIF in php

There is ternary operator(conditional) operator in php which is used for IIF equivalent condition in php. The conditional operator is the “?:” (or ternary) operator.

The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE.

Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates toTRUE, and expr3 otherwise.


 echo(($a==10)?'Yes its true':'Its false');