Using return in ternary operator

前端 未结 7 913
無奈伤痛
無奈伤痛 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条回答
  •  猫巷女王i
    2020-12-03 18:00

    No it's not possible, and it's also pretty confusing as compared to:

    if($e) {
        return array('false', $e);
    }
    

提交回复
热议问题