php ternary
$result = $condition ? 'foo' : 'bar';
Distinct Dolphin
$result = $condition ? 'foo' : 'bar';
$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;
print ($marks>=40) ? "pass" : "Fail";
<?php
$x=4;
$y=3;
if(x>y)?echo"X is large": echo "y is large";
?>
$if = function($test, $true, $false)
{
return $test ? $true : $false;
};
echo "class='{$if(true, 'abc', 'def')}'";
(condition) ? /* value to return if condition is true */
: /* value to return if condition is false */ ;
echo empty($address['street2']) ? "Street2 is empty!" : $address['street2'];