I was asked to perform this operation of ternary operator use:
$test=\'one\'; echo $test == \'one\' ? \'one\' : $test == \'two\' ? \'two\' : \'three\';
I think that it is evaluated like this:
echo ($test == 'one' ? 'one' : $test == 'two') ? 'two' : 'three';
($test == 'one' ? 'one' : $test == 'two') is non-zero/null, so 'two' is logical output
if you want it to work correctly, write:
echo $test == 'one' ? 'one' : ($test == 'two' ? 'two' : 'three');