127.0.0.1 Posted January 12, 2007 Share Posted January 12, 2007 Are ternary statements faster than if-statement comparisons?I prefer using ternary statements because I don't have to break out of an echo construct. However I've come to a point where I'd have to write a nested ternary statement. I read on [url=http://www.php.net/language.operators.comparison]php.net[/url] that "stacking" ternary statements (I interpret "stacking" as "nested" ternary comparisons) is not recommended. Link to comment https://forums.phpfreaks.com/topic/33865-to-ternary-or-not-to-ternary/ Share on other sites More sharing options...
Barand Posted January 12, 2007 Share Posted January 12, 2007 I avoid nesting them. Not for any speed or technical reason, but purely as a readability issue. It doen't help with making the code easy to understand. Link to comment https://forums.phpfreaks.com/topic/33865-to-ternary-or-not-to-ternary/#findComment-158938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.