Home > Article > Backend Development > Can this be used in php static methods?
This cannot be used in static methods
Static methods are loaded as the class is loaded, and static methods exist prior to objects. When we load a class, the object does not exist yet, and this represents a reference to the object. When we load the class, the object does not exist, so how can we use this? The answer is obvious
this refers to the current object. Static methods are methods called through classes and do not need to be instantiated. Since there is no need to instantiate, there is no current object. Since there is no current object, there will be no this
For more related knowledge, please pay attention to PHP Chinese website! !
The above is the detailed content of Can this be used in php static methods?. For more information, please follow other related articles on the PHP Chinese website!