Just stack up the parenthesis, and you've got it:
$bar = ($foo==1? "1" : ($foo==2? "2" : "other"));
As an aside, if you've got many clauses, you should consider using a switch
:
switch ( $bar ) {
case 1: echo "1";
case 2: echo "2";
default: echo "other";
}
If the switch gets long, you can wrap it in a function.