Your vote matters here! Login and vote now.
By bloid
via php.dzone.com
Published: Mar 18 2008 / 14:14
I started using ternary operator logic about six months ago and notice myself using shorthand if/else logic all the time. It shortens my code, the time to write it, and makes me look smarter to the mustaches.
Comments
robse replied ago:
ghastly ternary operator
sky_HALud replied ago:
The ternary operator has been one of the most confusing language constructs since the days of C. And I'm sure it wasn't meant to be nested! Just because it looks cool it doesn't mean that you should overuse it (hammer, nail - use them for everything).
As a side note, I recently took a close look on the code of phpBB 2 and that of nBB 2. One of the reasons why the code is so horrible is because ternary operators are overused. Another reason is the underuse of functions ("dump that thousand lines of code right in the page!").
Voters For This Link (12)
Voters Against This Link (2)