PHP: What does `array(&$this)` mean

phpthis

In PHP, I would like to know what array(&$this) means.

Best Solution

It's a construct that initializes an array which contains one element: a reference to the object the array is initialized in. Inside every class, you can refer to the "current" instance using $this.