In PHP, the keyword “$this” is used as a self reference of a class and you can use it for calling and using the class functions and variables. and here is an example:
class ClassOne { // this is a property of this class public $propertyOne; // When the ClassOne is instantiated, the first method called is // its constructor, which also is a method of the class public function __construct($argumentOne) { // this key word used here to assign // the argument to the class $this->propertyOne = $argumentOne; } // this is a method of the class function methodOne() { //this keyword also used here to use the value of variable $var1 return 'Method one print value for its ' . ' property $propertyOne: ' . $this->propertyOne; } }
and when you call parent::test() you actually calling the test function associated with the CLASS B since you are calling it statically. try call it $this->test() and you should get A not B.
$thisis of class 'A'.