php multi elseif statement ternary

35

$foo = 1;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;
(something) ? 'foo' : ((somethingElse) ? 'bar' : ((bla) ? 'pool' : ((xxxxx) ? 'coffe' : '')));

Comments

Submit
0 Comments