r/ProgrammerAnimemes • • May 20 '23

Ternary operator

Post image
1.5k Upvotes

41 comments sorted by

View all comments

Show parent comment

2

u/bucket3432 Jun 24 '23

Yes, as I noted at the end of my explanatory comment, this is the case for PHP 8. The ternary conditional operator became non-associative, resulting in unparenthesized ternaries becoming compile-time errors. It's valid syntax in PHP versions prior to 8.