Answers for "Multiple Ternary operator in php"

0

ternary operator for three conditions in php

$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;
Posted by: Guest on July-13-2020
0

Multiple Ternary operator in php

(something) ? 'foo' : ((somethingElse) ? 'bar' : ((bla) ? 'pool' : ((xxxxx) ? 'coffe' : '')));
Posted by: Guest on June-17-2021

Browse Popular Code Answers by Language