Why does my PHP ternary operator return “three” instead of “two” in versions < 5.3?

I’m having trouble understanding why my PHP code returns “three” instead of “two”. Here’s the code:

php
<?php $a = 2; echo $a == 1 ? "one" : $a == 2 ? "two" : $a == 3 ? "three" : "others"; ?>

When I run this in PHP versions earlier than 5.3, the output is “three”. Can someone explain why this happens and how the code works?