php - Multiple conditions in the ternary operator safe? -
I have seen the advice that says that the ternary operator should not be nested.
I have tested the code below and it works fine. My question is, I have not seen the use of a ternary operator like this before, so it is reliable because it was used in a Thanks! If the results are returning from you, the Ternary operator is only "true" and "false", then you No operator required. You may just: But to answer your question, yes many situations work perfectly well. if or something like this and then bites me (no Due to context or readability, but also due to failure).
$ rule1 = true; $ Rule2 = False; $ Rule3 = true; $ Res = (($ rule1 == true) & amp; ($ rule2 == incorrect) & amp; ($ rule3 == true))? right wrong; If ($ res) {echo "good"; } And {resonate "unsuccessful"; }
$ res = (($ rule1 === true) & amp; ($ rule2 === incorrect) & amp; ($ rule3 === True))
Comments
Post a Comment