PHP Inline wenn
/* most basic usage */
$var = 5;
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
Allen
/* most basic usage */
$var = 5;
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
$result = $condition ? 'foo' : 'bar';
$y = $x ? "true" : "false";
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')}'";