ternary statement php code example
Example 1: php ternary operator
(Condition) ? (Statement1) : (Statement2);
Example 2: ternary operator in php
<?php
$marks=40;
print ($marks>=40) ? "pass" : "Fail";
?>
Example 3: php ternary
$result = $condition ? 'foo' : 'bar';