default as first option in switch statement?

前端 未结 9 1796
后悔当初
后悔当初 2020-12-01 23:58

I\'ve tested this and it works fine, but it looks... weird... to me. Should I be concerned that this is nonstandard form which will be dropped in a future version of PHP, or

9条回答
  •  情深已故
    2020-12-02 00:23

    Kind of made me twinge at first, but that's just because we're not use to seeing things that way.

    I would suggest that you document this highly, since some might call this "tricky" code. A noob or some future maintainer might come along and move it to the bottom where they're more comfortable with it and break the side-effect that is has being at the top.

提交回复
热议问题