illustrate
1. The proximity principle of $this applies not only to private properties, but also to private member methods.
2. $this refers to the called object, but when dealing with private attributes and methods, the proximity principle will be followed and it will refer to the class where the method belongs.
Example
class AA { private function foo() { echo "success!n"; } public function test() { $this->foo(); static::foo(); } } classBBBB extends AA { } class CCC extends AA { private function foo() { echo 'CCC'; } } $b = new BBBB(); $b->test(); //Success Success $c = new CCC(); $c->test(); //Success error:Call to private method CCC::foo() from scope AA
The above is the proximity principle of $this in php. I hope it will be helpful to everyone.