PHP Ternary Operator
What are the Ternary Operators?
Ternary operator is another conditional operator.
(expr1) ? (expr2) : (expr3)
In the above syntax the expr1 is a condition when satisfied or true it evaluates expr2, otherwise expr3.
$mark = 50;
$result = ($mark>=60)? "Passed Exam":"Failed in Exam";
Failed in Exam
In the above example, marks of a student is checked in an expression, since its false the value "Failed in Exam" is displayed, if true the first value might be printed.