On Tue, Apr 12, 2011 at 6:34 AM, Richard Quadling <rquadl...@gmail.com>wrote:

> Without running the code, can you say what the output will be in the 3
> examples?
>

Yes, but I would still rewrite that code. ;) I typically reserve the ternary
operator to return a value or assign a variable. Given that it is used less
frequently combined with its precedence in PHP differing from other
languages make using it in complicated expressions prone to errors and
misunderstanding by others.

Adding parentheses avoids interpreter errors but doesn't lessen the
likelihood of another developer breaking the code if they modify it.

David

Reply via email to