Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Akronymus
· 3y ago · 0 comments
Should ternaries be left or right associative?
Comments
[–]
chiyc
3y ago
Right associative! It's just one of the many rites of passage for people working with PHP to get bitten by its left associative ternaries. Naked nested ternaries are deprecated now, but maybe one day, PHP can have right associative ternaries.
[–]
retrocryptid
3y ago
Except when it's not, like in perl.
[–]
balfebs
3y ago
Not sure what you mean, but ternaries are right-associative in Perl just like most other languages. PHP is the odd one out.
[–]
retrocryptid
3y ago
Except when they're not.