Search⌘ K

Challenge: The $this Keyword

Explore how to use the $this keyword to access class properties and enable method chaining in PHP. Learn by adding a hello method that accesses a property and returns a personalized greeting, strengthening your grasp of object interaction within classes.

We'll cover the following...

Task

  • Your task is to add the hello() method in the User class with the ability to approach the $firstName
...