tenary operator 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: ternary in php
print ($marks>=40) ? "pass" : "Fail";
Example 4: php ternary shorthand
$y = $x ? "true" : "false";