Tulis jika dan yang lain dalam satu baris PHP
$result = ($data->status == 1) ? 'active' : 'disable'
Zamir
$result = ($data->status == 1) ? 'active' : 'disable'
<?php echo ($requestVars->_name == '') ? $redText : ''; ?>
/* most basic usage */
$var = 5;
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
echo ($var1 >= $var2) ? 'this is true' : 'this is false';
<?php if ($requestVars->_name == '') echo $redText; ?>
$thisVar != $thatVar ?: doThis();
or
($thisVar == $thatVar) && doThis();
or
if ($thisVar == $thatVar) doThis();