In PHP, the ternary operator is left-associative (or from the manual, a little less clear).
this is because ternary expressions are evaluated from left to right
In Javascript, the ternary operator is right-associative.
note: the conditional operator is right associative
So, in PHP your code executes like this:
($value == 1 ?
'a' : $value == 2) ? 'b' : 'c';
And in Javascript, it executes like this:
value == 1 ?
'a' : (value == 2 ? 'b' : 'c');
So, to get the same results, you need to tell either one to act like the other:
echo $value == 1 ?
'a' : ($value == 2 ? 'b' : 'c');
This is (one of the?) the reason why nested ternary operators are a bad idea. They're not readable and prone to these kind of mistakes!