PHP- method in this keyword

Here Insert Picture DescriptionAfter this keyword, the effect is the same.

Here Insert Picture Description$ this is a "pseudo-object" on behalf of current belongs to the class of "current object."
The current object: who's currently called, who is the current object.

Here Insert Picture DescriptionQuestion: Why print an object, you can just print out the member attribute of the object?

Here Insert Picture DescriptionAgain: The property can not be accessed directly within the method, you need to find someone to access its objects, the typical approach is to use the $ this keyword in the method instead of the current object.

Guess you like

Origin blog.csdn.net/weixin_44097082/article/details/95062844