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

前端 未结 5 616

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:24

    This is fine. I should think you could do this also:

    $CI = $this;
    

    ... since assignations involving objects will always copy references, not whole objects.

提交回复
热议问题