unusual ternary operation

Posted by nik on Stack Overflow See other posts from Stack Overflow or by nik
Published on 2010-04-17T14:27:53Z Indexed on 2010/04/17 14:33 UTC
Read the original article Hit count: 292

Filed under:
|
|
|

Hi,

I was asked to perform this operation of ternary operator use:

$test='one';

echo $test == 'one' ? 'one' :  $test == 'two' ? 'two' : 'three';

Which prints two (checked using php).

I am still not sure about the logic for this. Please, can anybody tell me the logic for this.

© Stack Overflow or respective owner

Related posts about logic

Related posts about php