The pseudo variable $this is used within a class to access the properties of the calling object (i.e. itself).


To access properties of an object use $this with the small arrow -> access operator, and then the name of the property without its $ dollar sign:


e.g. $this->name


Using $this to access the object's properties:

Save & refresh browser:

Exploring an object's pseudo varibale $this

Using the display method to show the properties:
Ducati, Panigale, 1200, 175, 17,999


'make' => 'Ducati',
'model' => 'Panigale',
'capacity' => '1200',
'topSpeed' => '175',
'cost' => '17,999',

Leave a Reply