PHP Elseif Ternary Operators

后端 未结 3 526
半阙折子戏
半阙折子戏 2020-12-15 05:08

I am trying to convert the following code into a Ternary Operator, but it is not working and I am unsure why. I think my problem is that I do not know how to express the

3条回答
  •  天涯浪人
    2020-12-15 05:49

    $top = ($i == 0) ? '
    ' : (($i % 5 == 0) ? '
    ' : '');

    you need to add parenthesis' around the entire else block

提交回复
热议问题