Using return in ternary operator

前端 未结 7 915
無奈伤痛
無奈伤痛 2020-12-03 17:46

I\'m trying to use return in a ternary operator, but receive an error:

Parse error: syntax error, unexpected T_RETURN 

Here\'s the code:

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 18:12

    This is the correct syntax:

    return  !$e ? '' : array('false', $e);
    

提交回复
热议问题