php ternární operátor
(Condition) ? (Statement1) : (Statement2);
ternární operátor v php
<?php
$marks=40;
print ($marks>=40) ? "pass" : "Fail";
?>
ternární v php
print ($marks>=40) ? "pass" : "Fail";
php ternární operátoři
// Both ternary and if/else returns the same result
// ternary
$result = $condition ? 'foo' : 'bar';
// if/else
if ($condition) {
$result = 'foo'
} else {
$result = 'bar'
}
ternární výrazy php
$result = $condition ? 'foo' : 'bar';