ternary php operator code example
Example 1: php ternary operator
(Condition) ? (Statement1) : (Statement2);
Example 2: ternary operator for three conditions in php
$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;