Operator Ternary untuk tiga kondisi di PHP
$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;
Ankur
$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;
(something) ? 'foo' : ((somethingElse) ? 'bar' : ((bla) ? 'pool' : ((xxxxx) ? 'coffe' : '')));
$foo = 1;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;