Using `$this` in an anonymous function in PHP pre 5.4.0

前端 未结 5 608

The PHP manual states

It is not possible to use $this from anonymous function before PHP 5.4.0

on the anonymous

5条回答
  •  不知归路
    2020-12-02 22:17

    That seems alright if your passing by reference it's the correct way to do it. If your using PHP 5 you don't need the & symbol before $this as it will always pass by reference regardless.

提交回复
热议问题