Using return in ternary operator

前端 未结 7 797
無奈伤痛
無奈伤痛 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:16

    Plop,

    if you want modify your return with ternary ?

    it's totally possible.

    In this exemple, i have a function with array in parameters. This exemple function is used to parse users array. On return i have an array with user id and user username. But what happens if I do not have any users?

    Sorry for my bad english, i'm french user haha.

    N-D.

提交回复
热议问题