0

PHP Ternary Operator badly parsed when it's on two lines

Tony Johnston 12 years ago updated by Alexander Blach (Developer) 12 years ago 1

In PHP, the ternary operator, $foo == $bar ? true : false;, is misread if there is a line break after the quetstion mark, causing the symbols list to show method called null.

the "true :" in the new line seems to be parsed as a goto label in this case. The same happens in TextMate. If you enter something that is not a valid goto label, it works fine.