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