if elseif Else with conditional operator ? and : in PHP

Asked

Viewed 203 times

2

We know there is a way to make an if Else using conditional operator, but would you like to know if there is a way to make an IF ELSE IF in PHP using conditional operator? if yes how? could send me an example?

  • 1

    a()? b()? C: D : E; where it is obtained C sss a() &&b(), D sss a() && !b() and E sss !a()

  • @Jeffersonquesado did not understand

  • @Rui , finished now, had pressed send before time unintentionally

  • @Jeffersonquesado what would be sss ?

  • "If and only if"

  • $a ? $b : ( $c ? $d : ( $e ? $f : $g ) ) Just a warning, nested ternary instructions are hard to read.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.