What does this value mean in a class definition?

As I continue to try to improve myself as a junior PHP developer, I began to try to break other people's work. I find it helps me understand and also give me ideas.

Two things that I don't get in the PHP class are what this means and which array ($ this, 'some_function') means when I expect it to have a function name in it.

Many thanks

+3
source share
2 answers

See the PHP Guide to Classes and Objects . $thisrefers to an instance of an object. Also see the following questions:

array($this,'some_function') . PHP . , , call_user_func, some_function $this.

CW, , , , closevoting

+9

$this - . $this .

0

Source: https://habr.com/ru/post/1766167/


All Articles