http://stackoverflow.com/questions/1921422/php-nested-conditional-operator-bug discusses this as well. On a slightly brighter note: I've never used the ternary operator with two ternaries or more after each other. I think it shouldn't be over-used anyway. Even just using one ternary operator can be confusing for someone who doesn't use it often. So, I avoid it and so should any sane programmer unless its use is really the best thing to do. I use it with isset for example but not when there are more than two choices which is the case in the examples above. So, after all, I wouldn't be too bent out of shape if it stays left-to-right. Cheers, Tim Tim-Hinnerk Heuer Twitter: @geekdenz Blog: http://www.thheuer.com On 18 October 2013 21:06, Tim-Hinnerk Heuer <th.heuer@xxxxxxxxx> wrote: > Clearly you haven't read the whole thread. The subject line asks the > question: > "Why PHP sucks - farce or is there a bit of truth?" - and there is a link > to the article of which I found many more btw. > I am not dissing PHP at all. In fact, as I said, I have been a PHP > programmer for many years... > It was just one thing that puzzled me and that I followed up on. I even > asked: "Is it faster to execute/implement if evaluated left-to-right?" > which would be an argument for this. > > I've heard many people moan about lots of languages and there are > weaknesses in most if not all of them. > > All I'm trying to do here is improving the language by raising issues (one > at a time) on this list to better understand the language and get people > thinking. > > Another issue I found is: > Not so useful return values: > > <?php > $b = false; > $c = "orange"; > $a = $b || $c; > echo $a; > > outputs: > 1 > > JS seems more convenient here. As a scripting language it also has the > notion of truthy but returns the default value "orange". > > :-) > > Cheers, > Tim > > Tim-Hinnerk Heuer > > Twitter: @geekdenz > Blog: http://www.thheuer.com > > > On 18 October 2013 16:45, Robert Cummings <robert@xxxxxxxxxxxxx> wrote: > >> On 13-10-17 09:05 PM, Tim-Hinnerk Heuer wrote: >> >>> a - b = (+a) + (-b) = (-b) + (+a) >>> >>> The argument is about the ternary operator though: >>> #include<stdio.h> >>> >>> main() >>> { >>> int a = 1; >>> printf("%s", (a == 1) ? "one" : (a == 2) ? "two" : "three"); >>> >>> } >>> >>> in C outputs: >>> >>>> one >>>>> >>>> >>> So, why is PHP different? >>> >> >> Why not? Both are valid interpretations. if you don't want ambiguity, >> clarify the expression with parenthesis (as you've shown in a subsequent >> post). One can't hinge the entire argument of whether PHP sucks on a >> right-left/left-right interpretation of the ternary operator, yet this is >> what you've chosen to focus on. >> >> Let's also put things in perspective, when a language reaches an audience >> in the millions SOMEONE will have something to whine about... and it just >> so happens some people like to whine loudly like a baby with a soiled >> nappie. >> >> :) >> >> Cheers, >> Rob. >> -- >> E-Mail Disclaimer: Information contained in this message and any >> attached documents is considered confidential and legally protected. >> This message is intended solely for the addressee(s). Disclosure, >> copying, and distribution are prohibited unless authorized. >> > >