Skip to content

Tag: conditional-operator

Nested PHP ternary operator precedence

Yes, I know this is very bad code, but I’d still like to understand it: If $a is 11, then the result of the 1st line is “option 2”, but in the 2nd line, the result is “option 1” – what effect is the pair of brackets having? Answer The first line is parsed like so: Which is …