Parse error on explode('-','foo-bar')[0] (for instance)

前端 未结 4 1591
暗喜
暗喜 2020-12-11 22:46

Why doesn\'t php support this syntax:

$s = explode(\'-\', \'foo-bar\')[0];

?

4条回答
  •  不知归路
    2020-12-11 23:15

    It's a limitation in the PHP parser. There's no reason why it can't support this form of reduction, it just doesn't.

提交回复
热议问题